diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-02-12 11:46:44 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-02-12 11:46:44 +0100 |
commit | 23d7402c006e58ee1bf1895db2f317f60f1b5b94 (patch) | |
tree | 2e6f17824bcf8c944052c54cf66e0cf87d7dee00 /recording.c | |
parent | c9b5fd6588b70f8d675fde40864225c18fc459db (diff) | |
download | vdr-23d7402c006e58ee1bf1895db2f317f60f1b5b94.tar.gz vdr-23d7402c006e58ee1bf1895db2f317f60f1b5b94.tar.bz2 |
Now stopping scanning the video directory if there are too many levels of symbolic links
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/recording.c b/recording.c index e7efba0b..67a92b0f 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 1.134 2006/02/05 12:34:08 kls Exp $ + * $Id: recording.c 1.135 2006/02/12 11:34:19 kls Exp $ */ #include "recording.h" @@ -58,6 +58,8 @@ #define MAX_SUBTITLE_LENGTH 40 +#define MAX_LINK_LEVEL 6 + bool VfatFileSystem = false; cRecordings DeletedRecordings(true); @@ -811,7 +813,7 @@ void cRecordings::Refresh(bool Foreground) ScanVideoDir(VideoDirectory, Foreground); } -void cRecordings::ScanVideoDir(const char *DirName, bool Foreground) +void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLevel) { cReadDir d(DirName); struct dirent *e; @@ -821,7 +823,13 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground) asprintf(&buffer, "%s/%s", DirName, e->d_name); struct stat st; if (stat(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; char *old = buffer; buffer = ReadLink(old); free(old); @@ -849,7 +857,7 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground) delete r; } else - ScanVideoDir(buffer, Foreground); + ScanVideoDir(buffer, Foreground, LinkLevel + Link); } } free(buffer); |