1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved deleting stale lock files

This commit is contained in:
Klaus Schmidinger 2002-11-24 16:08:06 +01:00
parent 9ee568e199
commit b4d1358c50
3 changed files with 7 additions and 2 deletions

View File

@ -435,6 +435,7 @@ Oliver Endriss <o.endriss@gmx.de>
for reporting a bug in the EPG scanner, which broke 'Transfer Mode' as soon as for reporting a bug in the EPG scanner, which broke 'Transfer Mode' as soon as
it kicked in it kicked in
for providing examples for 'diseqc.conf' for providing examples for 'diseqc.conf'
for improving deleting stale lock files
Reinhard Walter Buchner <rw.buchner@freenet.de> Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf' for adding some satellites to 'sources.conf'

View File

@ -1808,3 +1808,7 @@ Video Disk Recorder Revision History
- Made some channels unique in 'channels.conf.terr' using the new RID. - Made some channels unique in 'channels.conf.terr' using the new RID.
- Extended the '-l' option to allow logging to LOG_LOCALn (n=0..7) by writing, for - Extended the '-l' option to allow logging to LOG_LOCALn (n=0..7) by writing, for
instance, '-l 3.7' (suggested by Jürgen Schmidt). instance, '-l 3.7' (suggested by Jürgen Schmidt).
- Now deleting stale lock files if they have a time stamp that is outside the window
'now +/- LOCKFILESTALETIME'. This improves things in cases where the system time
makes far jumps, so that a lock file might end up with a time stamp that lies
in the distant future (thanks to Oliver Endriss).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 1.74 2002/11/24 15:47:02 kls Exp $ * $Id: tools.c 1.75 2002/11/24 16:04:57 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -722,7 +722,7 @@ bool cLockFile::Lock(int WaitSeconds)
if (errno == EEXIST) { if (errno == EEXIST) {
struct stat fs; struct stat fs;
if (stat(fileName, &fs) == 0) { if (stat(fileName, &fs) == 0) {
if (time(NULL) - fs.st_mtime > LOCKFILESTALETIME) { if (abs(time(NULL)) - fs.st_mtime > LOCKFILESTALETIME) {
esyslog("ERROR: removing stale lock file '%s'", fileName); esyslog("ERROR: removing stale lock file '%s'", fileName);
if (remove(fileName) < 0) { if (remove(fileName) < 0) {
LOG_ERROR_STR(fileName); LOG_ERROR_STR(fileName);