diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-18 12:54:56 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-18 12:54:56 +0100 |
commit | 35d4ceaf371e5f19a41ba700bee4d5aaf2f15b64 (patch) | |
tree | 7ae6ec397029dbd19a269bf2879471245d65ee5f /recording.c | |
parent | 2e41129c3627c8981a5909173f5399fda47ed593 (diff) | |
download | vdr-35d4ceaf371e5f19a41ba700bee4d5aaf2f15b64.tar.gz vdr-35d4ceaf371e5f19a41ba700bee4d5aaf2f15b64.tar.bz2 |
Fixed deleting the source recording after moving it to a different volume (cont'd)
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/recording.c b/recording.c index d57e3f58..382a8ea2 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 3.12 2014/01/16 11:03:41 kls Exp $ + * $Id: recording.c 3.13 2014/01/18 12:54:56 kls Exp $ */ #include "recording.h" @@ -1519,22 +1519,24 @@ void cRecordings::DelByName(const char *FileName) { LOCK_THREAD; cRecording *recording = GetByName(FileName); - if (recording) { - cThreadLock DeletedRecordingsLock(&DeletedRecordings); + cRecording *dummy = NULL; + if (!recording) + recording = dummy = new cRecording(FileName); // allows us to use a FileName that is not in the Recordings list + cThreadLock DeletedRecordingsLock(&DeletedRecordings); + if (!dummy) Del(recording, false); - char *ext = strrchr(recording->fileName, '.'); - if (ext) { - strncpy(ext, DELEXT, strlen(ext)); - if (access(recording->FileName(), F_OK) == 0) { - recording->deleted = time(NULL); - DeletedRecordings.Add(recording); - recording = NULL; // to prevent it from being deleted below - } + char *ext = strrchr(recording->fileName, '.'); + if (ext) { + strncpy(ext, DELEXT, strlen(ext)); + if (access(recording->FileName(), F_OK) == 0) { + recording->deleted = time(NULL); + DeletedRecordings.Add(recording); + recording = NULL; // to prevent it from being deleted below } - delete recording; - ChangeState(); - TouchUpdate(); } + delete recording; + ChangeState(); + TouchUpdate(); } void cRecordings::UpdateByName(const char *FileName) @@ -1880,7 +1882,7 @@ bool cRecordingsHandlerEntry::Active(bool &Error) if (CopierFinishedOk && (Usage() & ruMove) != 0) { cRecording Recording(FileNameSrc()); if (Recording.Delete()) - DeletedRecordings.AddByName(Recording.FileName()); + Recordings.DelByName(Recording.FileName()); } Recordings.ChangeState(); Recordings.TouchUpdate(); |