]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: fix mingw failure on creating nonblocking pipe
authorEric Blake <eblake@redhat.com>
Thu, 31 Mar 2011 22:00:20 +0000 (16:00 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 1 Apr 2011 14:43:10 +0000 (08:43 -0600)
* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.

.gnulib
bootstrap.conf
src/util/util.c

diff --git a/.gnulib b/.gnulib
index 790645d837f8084991421107fba639b110d58335..dec3475763be252103922a887920012eeb32dc26 160000 (submodule)
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 790645d837f8084991421107fba639b110d58335
+Subproject commit dec3475763be252103922a887920012eeb32dc26
index 733c3541c769598b25053294ccd51470e908b0d2..ca0c3de1b2d18b0b993c38e78dba492552fbca67 100644 (file)
@@ -49,6 +49,7 @@ mkstemp
 mkstemps
 mktempd
 netdb
+nonblocking
 perror
 physmem
 pipe-posix
index 035036b5a58f56141be40e283060081363f67525..43794b14452a15d1ee98380f0486ad4d1b24f7cb 100644 (file)
@@ -77,6 +77,7 @@
 #include "verify.h"
 #include "files.h"
 #include "command.h"
+#include "nonblocking.h"
 
 #ifndef NSIG
 # define NSIG 32
@@ -246,26 +247,7 @@ virArgvToString(const char *const *argv)
 }
 
 int virSetBlocking(int fd, bool blocking) {
-#ifndef WIN32
-    int flags;
-    if ((flags = fcntl(fd, F_GETFL)) < 0)
-        return -1;
-    if (blocking)
-        flags &= ~O_NONBLOCK;
-    else
-        flags |= O_NONBLOCK;
-    if ((fcntl(fd, F_SETFL, flags)) < 0)
-        return -1;
-#else
-    unsigned long flag = blocking ? 0 : 1;
-
-    /* This is actually Gnulib's replacement rpl_ioctl function.
-     * We can't call ioctlsocket directly in any case.
-     */
-    if (ioctl (fd, FIONBIO, (void *) &flag) == -1)
-        return -1;
-#endif
-    return 0;
+    return set_nonblocking_flag (fd, !blocking);
 }
 
 int virSetNonBlock(int fd) {