Merge pull request #2622 from brauner/2018-09-19/attach_exit_status

attach: report standard shell exit codes
This commit is contained in:
Stéphane Graber 2018-09-19 11:49:02 +02:00 committed by GitHub
commit 95bdc9e7e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1510,14 +1510,23 @@ int lxc_attach(const char *name, const char *lxcpath,
_exit(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);
if (ret < 0) {
switch (errno) {
case ENOEXEC:
ret = 126;
case ENOENT:
ret = 127;
}
}
SYSERROR("Failed to exec \"%s\"", cmd->program);
return -1;
return ret;
}
int lxc_attach_run_shell(void* payload)