summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 0466ddbff3..e1e1c367f0 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -369,15 +369,13 @@ static int parse_argv(int argc, char *argv[]) {
free(arg_machine);
arg_machine = NULL;
} else {
-
- if (!hostname_is_valid(optarg)) {
+ if (!machine_name_is_valid(optarg)) {
log_error("Invalid machine name: %s", optarg);
return -EINVAL;
}
- free(arg_machine);
- arg_machine = strdup(optarg);
- if (!arg_machine)
+ r = free_and_strdup(&arg_machine, optarg);
+ if (r < 0)
return log_oom();
break;