diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-10-30 18:15:16 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-10-30 18:15:16 +0000 |
commit | 2c32441420fcb5c3ad12d44aea7fea11669a1d08 (patch) | |
tree | 362305cffc5d233ea01f1b91b49d93f8c6cae0bd | |
parent | 6fae1ebc493bd2c9bb3c6be646f9c2de74329952 (diff) | |
download | fetchmail-2c32441420fcb5c3ad12d44aea7fea11669a1d08.tar.gz fetchmail-2c32441420fcb5c3ad12d44aea7fea11669a1d08.tar.bz2 fetchmail-2c32441420fcb5c3ad12d44aea7fea11669a1d08.zip |
Exit with error if the lock file cannot be read.
svn path=/trunk/; revision=4374
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | lock.c | 8 |
2 files changed, 7 insertions, 2 deletions
@@ -249,6 +249,7 @@ fetchmail 6.3.0 (not yet released officially): configuration file. Matthias Andree * Bury on_exit officially - the necessary code had been missing from 6.0.0, 6.2.0, 6.2.5. Matthias Andree +* Exit with error if the lock file cannot be read. Matthias Andree # INTERNAL CHANGES * Switched to automake. Matthias Andree. @@ -73,9 +73,11 @@ int lock_state(void) int args = fscanf(lockfp, "%d %d", &pid, &st); bkgd = (args == 2); - if (ferror(lockfp)) + if (ferror(lockfp)) { fprintf(stderr, GT_("fetchmail: error reading lockfile \"%s\": %s\n"), lockfile, strerror(errno)); + exit(PS_EXCLUDE); + } if (args == 0 || kill(pid, 0) == -1) { fprintf(stderr,GT_("fetchmail: removing stale lockfile\n")); @@ -86,9 +88,11 @@ int lock_state(void) fclose(lockfp); /* not checking should be safe, file mode was "r" */ } else { pid = 0; - if (errno != ENOENT) + if (errno != ENOENT) { fprintf(stderr, GT_("fetchmail: error opening lockfile \"%s\": %s\n"), lockfile, strerror(errno)); + exit(PS_EXCLUDE); + } } return(bkgd ? -pid : pid); |