From: "Daniel P. Berrange" <berra...@redhat.com>

Only some of the return paths of lxcContainerWaitForContinue will
have set errno. In other paths we need to set it manually to avoid
the caller getting a random stale errno value

* src/lxc/lxc_container.c: Set errno in lxcContainerWaitForContinue
---
 src/lxc/lxc_container.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 06ccf7e..7a3589b 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -224,8 +224,13 @@ int lxcContainerWaitForContinue(int control)
     int readLen;
 
     readLen = saferead(control, &msg, sizeof(msg));
-    if (readLen != sizeof(msg) ||
-        msg != LXC_CONTINUE_MSG) {
+    if (readLen != sizeof(msg)) {
+        if (readLen >= 0)
+            errno = EIO;
+        return -1;
+    }
+    if (msg != LXC_CONTINUE_MSG) {
+        errno = EINVAL;
         return -1;
     }
 
-- 
1.7.6.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to