attach: report standard shell exit codes

custom backport Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 4523e218
...@@ -1403,13 +1403,25 @@ int lxc_attach(const char *name, const char *lxcpath, ...@@ -1403,13 +1403,25 @@ int lxc_attach(const char *name, const char *lxcpath,
rexit(0); rexit(0);
} }
int lxc_attach_run_command(void* payload) int lxc_attach_run_command(void *payload)
{ {
lxc_attach_command_t* cmd = (lxc_attach_command_t*)payload; int ret = -1;
lxc_attach_command_t *cmd = payload;
execvp(cmd->program, cmd->argv); ret = execvp(cmd->program, cmd->argv);
SYSERROR("Failed to exec \"%s\".", cmd->program); if (ret < 0) {
return -1; switch (errno) {
case ENOEXEC:
ret = 126;
break;
case ENOENT:
ret = 127;
break;
}
}
SYSERROR("Failed to exec \"%s\"", cmd->program);
return ret;
} }
int lxc_attach_run_shell(void* payload) int lxc_attach_run_shell(void* payload)
......
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