mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-02 13:40:14 +00:00
lxc-unshare: require an argument
It segfaults otherwise trying to execute &NULL. We could alternatively guess at a command to execute, such as a shell, but invariably there would be cases where the command we guess does not exist. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
30c5d29201
commit
a11a544f5f
@ -44,12 +44,11 @@ lxc_log_define(lxc_unshare_ui, lxc);
|
||||
|
||||
void usage(char *cmd)
|
||||
{
|
||||
fprintf(stderr, "%s <options> [command]\n", basename(cmd));
|
||||
fprintf(stderr, "%s <options> command [command_arguments]\n", basename(cmd));
|
||||
fprintf(stderr, "Options are:\n");
|
||||
fprintf(stderr, "\t -s flags: ORed list of flags to unshare:\n" \
|
||||
"\t MOUNT, PID, UTSNAME, IPC, USER, NETWORK\n");
|
||||
fprintf(stderr, "\t -u <id> : new id to be set if -s USER is specified\n");
|
||||
fprintf(stderr, "\t if -s PID is specified, <command> is mandatory)\n");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
@ -184,6 +183,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (argv[optind] == NULL) {
|
||||
ERROR("a command to execute in the new namespace is required");
|
||||
return 1;
|
||||
}
|
||||
|
||||
args = &argv[optind];
|
||||
|
||||
ret = lxc_caps_init();
|
||||
|
Loading…
Reference in New Issue
Block a user