From 5782601e3657aac1edde30746f82de8c70a905bd Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Tue, 22 Feb 2011 22:03:20 +0100 Subject: Got rid of backupmarks plugin option Fixed noatime detection in GetBroadcastStart --- command/markad-standalone.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'command/markad-standalone.cpp') diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 51e4950..f99ae92 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -1368,23 +1368,36 @@ time_t cMarkAdStandalone::GetBroadcastStart(time_t start, int fd) struct mntent *ent; struct stat statbuf; FILE *mounts=setmntent(_PATH_MOUNTED,"r"); + int mlen=0; + int oldmlen=0; + bool useatime=false; while ((ent=getmntent(mounts))!=NULL) { if (strstr(directory,ent->mnt_dir)) { - if (strstr(ent->mnt_opts,"noatime")) + mlen=strlen(ent->mnt_dir); + if (mlen>oldmlen) { - if (stat(directory,&statbuf)!=-1) + if (strstr(ent->mnt_opts,"noatime")) { - endmntent(mounts); - isyslog("getting broadcast start from directory atime"); - return statbuf.st_atime; + useatime=true; + } + else + { + useatime=false; } } + oldmlen=mlen; } } endmntent(mounts); + if ((useatime) && (stat(directory,&statbuf)!=-1)) + { + isyslog("getting broadcast start from directory atime"); + return statbuf.st_atime; + } + // try to get from mtime // (and hope info.vdr has not changed after the start of the recording) if (fstat(fd,&statbuf)!=-1) -- cgit v1.2.3