[PATCH 2/7] lxc: Don't report error in Wait/SendContinue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We will reuse these shortly, and each use should have a different error
message.

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/lxc/lxc_container.c  |   15 ++++++---------
 src/lxc/lxc_controller.c |    5 ++++-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 173af07..00add94 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -195,13 +195,10 @@ int lxcContainerSendContinue(int control)
 
     writeCount = safewrite(control, &msg, sizeof(msg));
     if (writeCount != sizeof(msg)) {
-        virReportSystemError(errno, "%s",
-                             _("Unable to send container continue message"));
         goto error_out;
     }
 
     rc = 0;
-
 error_out:
     return rc;
 }
@@ -224,13 +221,8 @@ static int lxcContainerWaitForContinue(int control)
     readLen = saferead(control, &msg, sizeof(msg));
     if (readLen != sizeof(msg) ||
         msg != LXC_CONTINUE_MSG) {
-        virReportSystemError(errno, "%s",
-                             _("Failed to read the container continue message"));
         return -1;
     }
-    VIR_FORCE_CLOSE(control);
-
-    VIR_DEBUG("Received container continue message");
 
     return 0;
 }
@@ -793,8 +785,12 @@ static int lxcContainerChild( void *data )
         goto cleanup;
 
     /* Wait for interface devices to show up */
-    if (lxcContainerWaitForContinue(argv->monitor) < 0)
+    if (lxcContainerWaitForContinue(argv->monitor) < 0) {
+        virReportSystemError(errno, "%s",
+                             _("Failed to read the container continue message"));
         goto cleanup;
+    }
+    VIR_DEBUG("Received container continue message");
 
     /* rename and enable interfaces */
     if (lxcContainerRenameAndEnableInterfaces(argv->nveths,
@@ -814,6 +810,7 @@ static int lxcContainerChild( void *data )
 cleanup:
     VIR_FREE(ttyPath);
     VIR_FORCE_CLOSE(ttyfd);
+    VIR_FORCE_CLOSE(argv->monitor);
 
     if (ret == 0) {
         /* this function will only return if an error occured */
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 5c4bd1f..cef4b58 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -731,8 +731,11 @@ lxcControllerRun(virDomainDefPtr def,
     if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
         goto cleanup;
 
-    if (lxcContainerSendContinue(control[0]) < 0)
+    if (lxcContainerSendContinue(control[0]) < 0) {
+        virReportSystemError(errno, "%s",
+                             _("Unable to send container continue message"));
         goto cleanup;
+    }
 
     /* Now the container is running, there's no need for us to keep
        any elevated capabilities */
-- 
1.7.4.4

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]