[libvirt] [PATCH] build: fix vircommand build on mingw

Eric Blake eblake at redhat.com
Fri Feb 15 20:14:37 UTC 2013


  CC       libvirt_util_la-vircommand.lo
../../src/util/vircommand.c:2358:1: error: 'virCommandHandshakeChild' defined but not used [-Werror=unused-function]

* src/util/vircommand.c (virCommandHandshakeChild): Hoist earlier,
so that win32 build doesn't hit an unused forward declaration.
---

Pushing under the build-breaker rule.

 src/util/vircommand.c | 98 +++++++++++++++++++++++++--------------------------
 1 file changed, 48 insertions(+), 50 deletions(-)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 5837fee..ee1b510 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -118,8 +118,6 @@ struct _virCommand {
 #endif
 };

-static int virCommandHandshakeChild(virCommandPtr cmd);
-
 /*
  * virCommandFDIsSet:
  * @fd: FD to test
@@ -332,6 +330,54 @@ prepareStdFd(int fd, int std)
     return 0;
 }

+/* virCommandHandshakeChild:
+ *
+ *   child side of handshake - called by child process in virExec() to
+ *   indicate to parent that the child process has successfully
+ *   completed its pre-exec initialization.
+ */
+static int
+virCommandHandshakeChild(virCommandPtr cmd)
+{
+    char c = '1';
+    int rv;
+
+    if (!cmd->handshake)
+       return true;
+
+    VIR_DEBUG("Notifying parent for handshake start on %d",
+              cmd->handshakeWait[1]);
+    if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) {
+        virReportSystemError(errno, "%s",
+                             _("Unable to notify parent process"));
+        return -1;
+    }
+
+    VIR_DEBUG("Waiting on parent for handshake complete on %d",
+              cmd->handshakeNotify[0]);
+    if ((rv = saferead(cmd->handshakeNotify[0], &c,
+                       sizeof(c))) != sizeof(c)) {
+        if (rv < 0)
+            virReportSystemError(errno, "%s",
+                                 _("Unable to wait on parent process"));
+        else
+            virReportSystemError(EIO, "%s",
+                                 _("libvirtd quit during handshake"));
+        return -1;
+    }
+    if (c != '1') {
+        virReportSystemError(EINVAL,
+                             _("Unexpected confirm code '%c' from parent"),
+                             c);
+        return -1;
+    }
+    VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
+    VIR_FORCE_CLOSE(cmd->handshakeNotify[0]);
+
+    VIR_DEBUG("Handshake with parent is done");
+    return 0;
+}
+
 /*
  * virExec:
  * @cmd virCommandPtr containing all information about the program to
@@ -2348,54 +2394,6 @@ void virCommandRequireHandshake(virCommandPtr cmd)
     cmd->handshake = true;
 }

-/* virCommandHandshakeChild:
- *
- *   child side of handshake - called by child process in virExec() to
- *   indicate to parent that the child process has successfully
- *   completed its pre-exec initialization.
- */
-static int
-virCommandHandshakeChild(virCommandPtr cmd)
-{
-    char c = '1';
-    int rv;
-
-    if (!cmd->handshake)
-       return true;
-
-    VIR_DEBUG("Notifying parent for handshake start on %d",
-              cmd->handshakeWait[1]);
-    if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) {
-        virReportSystemError(errno, "%s",
-                             _("Unable to notify parent process"));
-        return -1;
-    }
-
-    VIR_DEBUG("Waiting on parent for handshake complete on %d",
-              cmd->handshakeNotify[0]);
-    if ((rv = saferead(cmd->handshakeNotify[0], &c,
-                       sizeof(c))) != sizeof(c)) {
-        if (rv < 0)
-            virReportSystemError(errno, "%s",
-                                 _("Unable to wait on parent process"));
-        else
-            virReportSystemError(EIO, "%s",
-                                 _("libvirtd quit during handshake"));
-        return -1;
-    }
-    if (c != '1') {
-        virReportSystemError(EINVAL,
-                             _("Unexpected confirm code '%c' from parent"),
-                             c);
-        return -1;
-    }
-    VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
-    VIR_FORCE_CLOSE(cmd->handshakeNotify[0]);
-
-    VIR_DEBUG("Handshake with parent is done");
-    return 0;
-}
-
 /**
  * virCommandHandshakeWait:
  * @cmd: command to wait on
-- 
1.8.1.2




More information about the libvir-list mailing list