]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: fix vircommand build on mingw
authorEric Blake <eblake@redhat.com>
Fri, 15 Feb 2013 20:13:47 +0000 (13:13 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 15 Feb 2013 20:16:46 +0000 (13:16 -0700)
  CC       libvirt_util_la-vircommand.lo
../../src/util/vircommand.c:2358:1: error: 'virCommandHandshakeChild' defined but not used [-Werror=unused-function]

The function is only implemented inside #ifndef WIN32.

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

src/util/vircommand.c

index 5837feec79d3c3c3e100ce45f4c5484fbef8c83f..ee1b510e0076fc30070678118067194f797325c5 100644 (file)
@@ -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