summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-02-17 14:02:13 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-02-17 14:02:13 +0100
commit882691e32f4b2488aa23e0844cc6185cd89e3301 (patch)
treecc790e849dea3586c4d959919d8a6731995c03f4 /recording.c
parentf1eecdeb1c10e51a85a33ed41aacd34a9e2353f0 (diff)
downloadvdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.gz
vdr-882691e32f4b2488aa23e0844cc6185cd89e3301.tar.bz2
cReadDir::Next() now skips directory entries "." and ".."
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c58
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);
}
}
}