From: Stéphane Graber Date: Tue, 14 Jan 2014 23:25:44 +0000 (-0500) Subject: Fix return value of userns_exec_1 X-Git-Tag: lxc-1.0.0.beta2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3139aead4d5e91147ae6dfc1ac3ef516bcde7222;p=thirdparty%2Flxc.git Fix return value of userns_exec_1 Instead of always returning -1 and call SYSERROR when the child returns non-zero. Have userns_exec_1 always return the return value from the function it's calling and let the caller do the error handling (as is already done by its only caller). Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 7e0edddec..159684cdb 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -4054,10 +4054,11 @@ int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data) goto err; } - if ((ret = wait_for_pid(pid)) < 0) { - ERROR("Child returned an error: %d\n", ret); - goto err; - } + ret = wait_for_pid(pid); + + close(p[1]); + return ret; + err: if (p[0] != -1) close(p[0]);