[libvirt] [PATCH 1/3] fdstream: report error if virSetNonBlock fails

Roman Bogorodskiy bogorodskiy at gmail.com
Fri Aug 15 08:44:20 UTC 2014


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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index fd576ef..d236318 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -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;
-- 
1.9.0




More information about the libvir-list mailing list