[PATCH 1/2] build: fix virpidfile on mingw

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---

> We already skip the /proc check on non-Linux. So I say we just skip
> the kill call on Win32.  This stuff is only an extra sanity check
> Nupon loading the pidfile, so I think returning an error is too
> mean and we just skip the kill check

Done, and pushing under the build-breaker rule.

 src/util/virpidfile.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index e64b0b3..8206e1a 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -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) &&
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]