Fix test for fcntl return value.
authorBen Pfaff <blp@nicira.com>
Thu, 28 Aug 2008 20:15:32 +0000 (13:15 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 28 Aug 2008 20:15:32 +0000 (13:15 -0700)
POSIX only says that -1 is an error; other return values have unspecified
meanings.

lib/daemon.c

index b597717..58581b7 100644 (file)
@@ -103,7 +103,7 @@ make_pidfile(void)
             lck.l_whence = SEEK_SET;
             lck.l_start = 0;
             lck.l_len = 0;
-            if (fcntl(fd, F_SETLK, &lck) >= 0) {
+            if (fcntl(fd, F_SETLK, &lck) != -1) {
                 char *text = xasprintf("%ld\n", pid);
                 if (write(fd, text, strlen(text)) == strlen(text)) {
                     fatal_signal_add_file_to_unlink(pidfile);