From 044dc48da47a5f5b2dd32212075da4b5e34840e8 Mon Sep 17 00:00:00 2001 Message-Id: <044dc48da47a5f5b2dd32212075da4b5e34840e8.1381871412.git.jdenemar@redhat.com> From: "Daniel P. Berrange" Date: Mon, 14 Oct 2013 16:45:26 +0100 Subject: [PATCH] Ensure lxcContainerMain reports errors on stderr For https://bugzilla.redhat.com/show_bug.cgi?id=927072 Ensure the lxcContainerMain method reports any errors that occur during setup to stderr, where libvirtd will pick them up. Signed-off-by: Daniel P. Berrange (cherry picked from commit 558546fb8f7104ad7fbdd14c615404618ce91453) Signed-off-by: Jiri Denemark --- src/lxc/lxc_container.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index f6375b7..06fb08d 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1876,6 +1876,15 @@ cleanup: ret = virCommandExec(cmd); } + if (ret != 0) { + virErrorPtr err = virGetLastError(); + if (err && err->message) + fprintf(stderr, "%s\n", err->message); + else + fprintf(stderr, "%s\n", + _("Unknown failure in libvirt_lxc startup")); + } + virCommandFree(cmd); return ret; } -- 1.8.3.2