From 7bba79ef0a2fe6055c6874fdba2d302c8ba3ad5a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 19 Mar 2006 14:36:43 +0100 Subject: [PATCH] Fixed deleting recordings that have been removed externally when running out of disk space --- CONTRIBUTORS | 4 ++++ HISTORY | 2 ++ recording.c | 13 +++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2b3641c8..80349ed2 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1781,3 +1781,7 @@ Pekka Mauno Alexander Wenzel for fixing the shutdown timeout + +Jan Lenz + for reporting a bug in deleting recordings that have been removed externally when + running out of disk space diff --git a/HISTORY b/HISTORY index c03e27c9..a7651cba 100644 --- a/HISTORY +++ b/HISTORY @@ -4432,3 +4432,5 @@ Video Disk Recorder Revision History - Fixed the shutdown timeout (thanks to Alexander Wenzel). - Only calling RemoveEmptyVideoDirectories() once in case a recording has been deleted (reported by Hardy Flor). +- Fixed deleting recordings that have been removed externally when running out of + disk space (reported by Jan Lenz). diff --git a/recording.c b/recording.c index 6c1692b8..55ab9396 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.141 2006/03/19 14:08:58 kls Exp $ + * $Id: recording.c 1.142 2006/03/19 14:33:18 kls Exp $ */ #include "recording.h" @@ -804,11 +804,16 @@ bool cRecording::Delete(void) strncpy(ext, DELEXT, strlen(ext)); if (access(NewName, F_OK) == 0) { // the new name already exists, so let's remove that one first: - isyslog("removing recording %s", NewName); + isyslog("removing recording '%s'", NewName); RemoveVideoFile(NewName); } - isyslog("deleting recording %s", FileName()); - result = RenameVideoFile(FileName(), NewName); + isyslog("deleting recording '%s'", FileName()); + if (access(FileName(), F_OK) == 0) + result = RenameVideoFile(FileName(), NewName); + else { + isyslog("recording '%s' vanished", FileName()); + result = true; // well, we were going to delete it, anyway + } } free(NewName); return result;