From: Ben Pfaff Date: Wed, 21 Jan 2009 00:34:11 +0000 (-0800) Subject: daemon: Fix behavior in read_pidfile() when pid file is not locked. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9f0103ebf7cdaa4f68ebf850c3e57b3b8d351c7;p=openvswitch daemon: Fix behavior in read_pidfile() when pid file is not locked. --- 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)) {