]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix return value of userns_exec_1
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 14 Jan 2014 23:25:44 +0000 (18:25 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 14 Jan 2014 23:35:43 +0000 (18:35 -0500)
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 <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 7e0edddecf4cc811c00ee8445d3b13f6e87dd804..159684cdbe8f88d137fe6fbecfd734264de749a9 100644 (file)
@@ -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]);