From e9f0103ebf7cdaa4f68ebf850c3e57b3b8d351c7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 20 Jan 2009 16:34:11 -0800 Subject: [PATCH] daemon: Fix behavior in read_pidfile() when pid file is not locked. --- lib/daemon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/daemon.c b/lib/daemon.c index 38cbc7b2..83465493 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -276,6 +276,11 @@ read_pidfile(const char *pidfile) VLOG_WARN("%s: fcntl: %s", pidfile, strerror(error)); goto error; } + if (lck.l_type == F_UNLCK) { + error = ESRCH; + VLOG_WARN("%s: pid file is not locked", pidfile); + goto error; + } if (!fgets(line, sizeof line, file)) { if (ferror(file)) { -- 2.30.2