Commit b3223262 by dlezcano

Return error code in child process

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 6373bd68
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment