Skip to content

Commit

Permalink
attach: report standard shell exit codes
Browse files Browse the repository at this point in the history
custom backport

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 10, 2018
1 parent 4523e21 commit 4941288
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/lxc/attach.c
Expand Up @@ -1403,13 +1403,25 @@ int lxc_attach(const char *name, const char *lxcpath,
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);
SYSERROR("Failed to exec \"%s\".", cmd->program);
return -1;
ret = execvp(cmd->program, cmd->argv);
if (ret < 0) {
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)
Expand Down

0 comments on commit 4941288

Please sign in to comment.