]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Return error code in child process
authordlezcano <dlezcano>
Fri, 21 Nov 2008 15:56:38 +0000 (15:56 +0000)
committerdlezcano <dlezcano>
Fri, 21 Nov 2008 15:56:38 +0000 (15:56 +0000)
From: Daniel Lezcano <dlezcano@fr.ibm.com>

Return the error code when the exec fails in the child process, that
decreases the granularity of the error given to the user.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/start.c

index 556767591aabfc87481f45b6e6544d13d978df08..3032da7b8805cef1899ba1fe846426689dc87036 100644 (file)
@@ -128,6 +128,7 @@ int lxc_start(const char *name, char *argv[])
                execvp(argv[0], argv);
                lxc_log_syserror("failed to exec %s", argv[0]);
 
+               err = LXC_ERROR_WRONG_COMMAND;
                /* If the exec fails, tell that to our father */
                if (write(sv[0], &err, sizeof(err)) < 0)
                        lxc_log_syserror("failed to write the socket");
@@ -168,8 +169,6 @@ int lxc_start(const char *name, char *argv[])
 
        if (err > 0) {
                err = sync;
-               printf("error value is %d\n", err);
-               /* TODO : check status etc ... */
                waitpid(pid, NULL, 0);
                goto err_child_failed;
        }