From da3c471467e44ca469c0e5db8565ef8ffc0f2a33 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 31 Mar 2011 16:00:20 -0600 Subject: [PATCH] virsh: fix mingw failure on creating nonblocking pipe * .gnulib: Update to latest, for nonblocking module. * bootstrap.conf (gnulib_modules): Add nonblocking. * src/util/util.c (virSetBlocking): Defer to gnulib. --- .gnulib | 2 +- bootstrap.conf | 1 + src/util/util.c | 22 ++-------------------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.gnulib b/.gnulib index 790645d837..dec3475763 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 790645d837f8084991421107fba639b110d58335 +Subproject commit dec3475763be252103922a887920012eeb32dc26 diff --git a/bootstrap.conf b/bootstrap.conf index 733c3541c7..ca0c3de1b2 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -49,6 +49,7 @@ mkstemp mkstemps mktempd netdb +nonblocking perror physmem pipe-posix diff --git a/src/util/util.c b/src/util/util.c index 035036b5a5..43794b1445 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -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) {