diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-14 14:16:44 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-14 19:32:07 +0200 |
commit | fee9f7b5c70477bb96c61cce8b542e4148f896cd (patch) | |
tree | 564c54e293eaf51ec9ad276b73bc9c5a820d0566 /src/nspawn | |
parent | 807626d1ce1c963715ebb3946d25734e748b8270 (diff) | |
download | systemd-fee9f7b5c70477bb96c61cce8b542e4148f896cd.tar.gz |
nspawn: simplify error handling
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 9e5b7772ac..49802d6fdf 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -877,17 +877,15 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_NETWORK_ZONE: { - char *j; + _cleanup_free_ char *j = NULL; j = strjoin("vz-", optarg); if (!j) return log_oom(); - if (!ifname_valid(j)) { - log_error("Network zone name not valid: %s", j); - free(j); - return -EINVAL; - } + if (!ifname_valid(j)) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Network zone name not valid: %s", j); free_and_replace(arg_network_zone, j); |