[lxc-devel] [PATCH 1/3] Require an argument for lxc-unshare
Serge Hallyn
serge.hallyn at canonical.com
Thu Jun 14 22:32:48 UTC 2012
It segfaults otherwise, trying to execute &NULL.
(i.e. lxc-unshare -s MOUNT)
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
src/lxc/lxc_unshare.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_unshare.c b/src/lxc/lxc_unshare.c
index 0baccb0..5f342f2 100644
--- a/src/lxc/lxc_unshare.c
+++ b/src/lxc/lxc_unshare.c
@@ -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();
--
1.7.9.5
More information about the lxc-devel
mailing list