summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-11-24 16:08:06 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-11-24 16:08:06 +0100
commitb4d1358c50fb095eb7a2daf494780ce193ffb453 (patch)
tree579ab101c24f2ee53e14f9ce3ce5f09efdf6152b
parent9ee568e1991f1c2eaae885593db5c2f1d2c8f754 (diff)
downloadvdr-b4d1358c50fb095eb7a2daf494780ce193ffb453.tar.gz
vdr-b4d1358c50fb095eb7a2daf494780ce193ffb453.tar.bz2
Improved deleting stale lock files1.1.17
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY4
-rw-r--r--tools.c4
3 files changed, 7 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 83af710c..d8ecbf35 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -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
it kicked in
for providing examples for 'diseqc.conf'
+ for improving deleting stale lock files
Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf'
diff --git a/HISTORY b/HISTORY
index c3eb6a8e..4d215082 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1808,3 +1808,7 @@ Video Disk Recorder Revision History
- 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
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).
diff --git a/tools.c b/tools.c
index a6bc80b1..c34a6217 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -722,7 +722,7 @@ bool cLockFile::Lock(int WaitSeconds)
if (errno == EEXIST) {
struct stat fs;
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);
if (remove(fileName) < 0) {
LOG_ERROR_STR(fileName);