From 743a3ec12327fa8c86bce73d5c47b70b6c187194 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 24 May 2003 11:22:34 +0200 Subject: Fixed resume file handling in case the resume.vdr file can't be written --- CONTRIBUTORS | 1 + HISTORY | 2 ++ recording.c | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9bc2909c..7d4c65b4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -506,6 +506,7 @@ Gerhard Steiner records as a newline character for reporting a bug in displaying messages in the status line in case they exceed the OSD width + for fixing resume file handling in case the resume.vdr file can't be written Jaakko Hyvätti for translating OSD texts to the Finnish language diff --git a/HISTORY b/HISTORY index 61f5d022..f136a92f 100644 --- a/HISTORY +++ b/HISTORY @@ -2182,3 +2182,5 @@ Video Disk Recorder Revision History - Completed the Finnish OSD texts (thanks to Niko Tarnanen and Rolf Ahrenberg). - Fixed I/O handling in case an explicit controlling terminal is given (thanks to Oliver Endriss). +- Fixed resume file handling in case the resume.vdr file can't be written + (thanks to Gerhard Steiner). diff --git a/recording.c b/recording.c index 9105157a..7e68a791 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.78 2003/05/18 15:17:45 kls Exp $ + * $Id: recording.c 1.79 2003/05/24 11:22:34 kls Exp $ */ #include "recording.h" @@ -169,6 +169,11 @@ int cResumeFile::Read(void) { int resume = -1; if (fileName) { + struct stat st; + if (stat(fileName, &st) == 0) { + if ((st.st_mode & S_IWUSR) == 0) // no write access, assume no resume + return -1; + } int f = open(fileName, O_RDONLY); if (f >= 0) { if (safe_read(f, &resume, sizeof(resume)) != sizeof(resume)) { -- cgit v1.2.3