From 854e4ee087143f432412d9e0775fd15a7758307d Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
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 0a3af26ff..3b766b518 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -275,6 +275,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.47.0