]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: fix virpidfile on mingw
authorEric Blake <eblake@redhat.com>
Wed, 17 Aug 2011 17:46:35 +0000 (11:46 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 17 Aug 2011 17:51:24 +0000 (11:51 -0600)
Regression introduced in commit b7e5ca4.

Mingw lacks kill(), but we were only using it for a sanity check;
so we can go with one less check.

Also, on OOM error, this function should outright fail rather than
claim that the pid file was successfully read.

* src/util/virpidfile.c (virPidFileReadPathIfAlive): Skip kill
call where unsupported, and report error on OOM.

src/util/virpidfile.c

index e64b0b3139b13969fa4c3654f93f949c14ea88d4..8206e1a6d54409bd4cb1a2494cfae083bbf58402 100644 (file)
@@ -200,15 +200,18 @@ int virPidFileReadPathIfAlive(const char *path,
     if (rc < 0)
         return rc;
 
-    /* Check that it's still alive */
+#ifndef WIN32
+    /* Check that it's still alive.  Safe to skip this sanity check on
+     * mingw, which lacks kill().  */
     if (kill(*pid, 0) < 0) {
         *pid = -1;
         return 0;
     }
+#endif
 
     if (virAsprintf(&procpath, "/proc/%d/exe", *pid) < 0) {
         *pid = -1;
-        return 0;
+        return -1;
     }
 
     if (virFileIsLink(procpath) &&