From 2c32441420fcb5c3ad12d44aea7fea11669a1d08 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 30 Oct 2005 18:15:16 +0000 Subject: Exit with error if the lock file cannot be read. svn path=/trunk/; revision=4374 --- lock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lock.c') diff --git a/lock.c b/lock.c index 89bf896a..f29129d1 100644 --- a/lock.c +++ b/lock.c @@ -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); -- cgit v1.2.3