diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-17 14:02:13 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-17 14:02:13 +0100 |
commit | 882691e32f4b2488aa23e0844cc6185cd89e3301 (patch) | |
tree | cc790e849dea3586c4d959919d8a6731995c03f4 /recording.c | |
parent | f1eecdeb1c10e51a85a33ed41aacd34a9e2353f0 (diff) | |
download | vdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.gz vdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.bz2 |
cReadDir::Next() now skips directory entries "." and ".."
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/recording.c b/recording.c index 6f7d8850..ac1ff2c7 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.48 2012/02/16 11:53:13 kls Exp $ + * $Id: recording.c 2.49 2012/02/17 13:57:05 kls Exp $ */ #include "recording.h" @@ -1109,40 +1109,38 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLev cReadDir d(DirName); struct dirent *e; while ((Foreground || Running()) && (e = d.Next()) != NULL) { - if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) { - cString buffer = AddDirectory(DirName, e->d_name); - struct stat st; - if (lstat(buffer, &st) == 0) { - int Link = 0; - if (S_ISLNK(st.st_mode)) { - if (LinkLevel > MAX_LINK_LEVEL) { - isyslog("max link level exceeded - not scanning %s", *buffer); - continue; - } - Link = 1; - if (stat(buffer, &st) != 0) - continue; + cString buffer = AddDirectory(DirName, e->d_name); + struct stat st; + if (lstat(buffer, &st) == 0) { + int Link = 0; + if (S_ISLNK(st.st_mode)) { + if (LinkLevel > MAX_LINK_LEVEL) { + isyslog("max link level exceeded - not scanning %s", *buffer); + continue; } - if (S_ISDIR(st.st_mode)) { - if (endswith(buffer, deleted ? DELEXT : RECEXT)) { - cRecording *r = new cRecording(buffer); - if (r->Name()) { - r->NumFrames(); // initializes the numFrames member - Lock(); - Add(r); - ChangeState(); - Unlock(); - if (deleted) { - r->fileSizeMB = DirSizeMB(buffer); - r->deleted = time(NULL); - } + Link = 1; + if (stat(buffer, &st) != 0) + continue; + } + if (S_ISDIR(st.st_mode)) { + if (endswith(buffer, deleted ? DELEXT : RECEXT)) { + cRecording *r = new cRecording(buffer); + if (r->Name()) { + r->NumFrames(); // initializes the numFrames member + Lock(); + Add(r); + ChangeState(); + Unlock(); + if (deleted) { + r->fileSizeMB = DirSizeMB(buffer); + r->deleted = time(NULL); } - else - delete r; } else - ScanVideoDir(buffer, Foreground, LinkLevel + Link); + delete r; } + else + ScanVideoDir(buffer, Foreground, LinkLevel + Link); } } } |