From 5b4507da05453538b40d6c8801223238b11cc482 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 12 Feb 2005 10:19:03 +0100 Subject: [PATCH] Fixed handling symbolic links in cRecordings::ScanVideoDir() --- CONTRIBUTORS | 1 + HISTORY | 4 +++- recording.c | 7 ++++--- tools.h | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ea353802..b5a150fa 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -192,6 +192,7 @@ Stefan Huelswitt for fixing a possible race condition in cDevice::Action() and cTSBuffer::Action() for reporting several memory leaks that were introduced through the use of cString for adding MPEG1 replay capability to cPesAssembler + for fixing handling symbolic links in cRecordings::ScanVideoDir() Ulrich Röder for pointing out that there are channels that have a symbol rate higher than 27500 diff --git a/HISTORY b/HISTORY index 73a342d8..d79e983d 100644 --- a/HISTORY +++ b/HISTORY @@ -3374,7 +3374,7 @@ Video Disk Recorder Revision History out). - Added MPEG1 replay capability to cPesAssembler (thanks to Stefan Huelswitt). -2005-02-08: Version 1.3.21 +2005-02-12: Version 1.3.21 - Fixed cDvbDevice::SetAudioTrackDevice() to avoid a blank screen after switching back to live mode if a recording is currently active on the primary device. @@ -3384,3 +3384,5 @@ Video Disk Recorder Revision History - Restricted the "setting audio track" log message to automatic changes during replay. - Fixed handling Transfer Mode for radio channels (thanks to Andreas Regel for reporting this one). +- Fixed handling symbolic links in cRecordings::ScanVideoDir() (thanks to Stefan + Huelswitt). diff --git a/recording.c b/recording.c index c6460f27..e50dfcb7 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.95 2005/02/06 09:46:31 kls Exp $ + * $Id: recording.c 1.96 2005/02/12 10:17:47 kls Exp $ */ #include "recording.h" @@ -637,8 +637,9 @@ void cRecordings::ScanVideoDir(const char *DirName) struct stat st; if (stat(buffer, &st) == 0) { if (S_ISLNK(st.st_mode)) { - free(buffer); - buffer = ReadLink(buffer); + char *old = buffer; + buffer = ReadLink(old); + free(old); if (!buffer) continue; if (stat(buffer, &st) != 0) { diff --git a/tools.h b/tools.h index bf190890..be8782bf 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.66 2005/02/05 10:00:22 kls Exp $ + * $Id: tools.h 1.67 2005/02/12 10:17:14 kls Exp $ */ #ifndef __TOOLS_H @@ -95,7 +95,7 @@ bool DirectoryOk(const char *DirName, bool LogErrors = false); bool MakeDirs(const char *FileName, bool IsDirectory = false); bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false); bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false); -char *ReadLink(const char *FileName); +char *ReadLink(const char *FileName); ///< returns a new strings allocated on the heap, which the caller must delete (or NULL in case of an error) bool SpinUpDisk(const char *FileName); time_t LastModifiedTime(const char *FileName); cString WeekDayName(int WeekDay);