summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2018-01-16 11:09:26 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2018-01-16 11:09:26 +0100
commite7936c8595f183cc0a916a27ff1ac613419a6b92 (patch)
tree745dc4d8e9788da539620fe8de5d51b540316d13 /recording.c
parent5467bc4f24666cb831c9195f4e5d4294f5dc956e (diff)
downloadvdr-e7936c8595f183cc0a916a27ff1ac613419a6b92.tar.gz
vdr-e7936c8595f183cc0a916a27ff1ac613419a6b92.tar.bz2
Fixed wrongly deleting a recording that already exists when moving a recording
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/recording.c b/recording.c
index 51013e33..0dd4da5f 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 4.15 2017/12/14 15:14:59 kls Exp $
+ * $Id: recording.c 4.16 2018/01/16 11:09:26 kls Exp $
*/
#include "recording.h"
@@ -1237,7 +1237,10 @@ bool cRecording::ChangeName(const char *NewName)
free(name);
name = strdup(NewName);
cString NewFileName = FileName();
- if (!(MakeDirs(NewFileName, true) && cVideoDirectory::MoveVideoFile(OldFileName, NewFileName))) {
+ bool Exists = access(NewFileName, F_OK) == 0;
+ if (Exists)
+ esyslog("ERROR: recording '%s' already exists", NewName);
+ if (Exists || !(MakeDirs(NewFileName, true) && cVideoDirectory::MoveVideoFile(OldFileName, NewFileName))) {
free(name);
name = strdup(OldName);
free(fileName);