Merge pull request #2114 from brauner/2018-01-27/make_name_arg_optional

tools: make "-n" optional
This commit is contained in:
Serge Hallyn 2018-01-31 22:11:48 -06:00 committed by GitHub
commit 0bf1c3082f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,10 +256,18 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
}
/* Check the command options */
if (!args->name && strcmp(args->progname, "lxc-autostart") != 0) {
lxc_error(args, "missing container name, use --name option");
return -1;
if (args->argv) {
args->name = argv[optind];
optind++;
args->argv = &argv[optind];
args->argc = argc - optind;
}
if (!args->name) {
lxc_error(args, "No container name specified");
return -1;
}
}
if (args->checker)