daemon: Fix segfault in read_pidfile() when pidfile does not exist.
authorBen Pfaff <blp@nicira.com>
Wed, 21 Jan 2009 00:33:32 +0000 (16:33 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 21 Jan 2009 00:44:14 +0000 (16:44 -0800)
lib/daemon.c

index 4d7b044b0f2e913c4a1eb20fa2020ac7d2043011..a3b824e6a9ef4b048f88e2bbbea154e1b52fccef 100644 (file)
@@ -294,6 +294,8 @@ read_pidfile(const char *pidfile)
     return lck.l_pid;
 
 error:
-    fclose(file);
+    if (file) {
+        fclose(file);
+    }
     return -error;
 }