]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
fdstream: report error if virSetNonBlock fails
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Fri, 15 Aug 2014 04:55:15 +0000 (08:55 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 25 Aug 2014 05:59:10 +0000 (09:59 +0400)
virFDStreamOpenInternal terminates if virSetNonBlock fails. As
virSetNonBlock uses gnulib's set_nonblocking_flag that sets errno,
call virReportSystemError() to let user know the reason of fail.

src/fdstream.c

index fd576ef26e1339d5b317e839dd5d23bb0ad0c8b5..d236318994bb6f63fd3b8b4afc919790dae513e0 100644 (file)
@@ -478,8 +478,10 @@ static int virFDStreamOpenInternal(virStreamPtr st,
               st, fd, cmd, errfd, length);
 
     if ((st->flags & VIR_STREAM_NONBLOCK) &&
-        virSetNonBlock(fd) < 0)
+        virSetNonBlock(fd) < 0) {
+        virReportSystemError(errno, "%s", _("Unable to set non-blocking mode"));
         return -1;
+    }
 
     if (VIR_ALLOC(fdst) < 0)
         return -1;