diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-09 16:06:36 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-10 14:46:59 +0100 |
commit | 7211c853c26554ad1f58c2cfa1d5a0bfc059bf15 (patch) | |
tree | 8ec5ffd55875cf64df5df97d7cf10c6449d23fea /src/nspawn | |
parent | Return -EINVAL from _from_string() functions (diff) | |
download | systemd-7211c853c26554ad1f58c2cfa1d5a0bfc059bf15.tar.xz systemd-7211c853c26554ad1f58c2cfa1d5a0bfc059bf15.zip |
tree-wide: propagate error code from _from_string() functions
Now that we know we have something useful, no need to make an answer up.
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-oci.c | 2 | ||||
-rw-r--r-- | src/nspawn/nspawn.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/nspawn/nspawn-oci.c b/src/nspawn/nspawn-oci.c index fe5768b022..dfa5c833c5 100644 --- a/src/nspawn/nspawn-oci.c +++ b/src/nspawn/nspawn-oci.c @@ -205,7 +205,7 @@ static int oci_rlimit_type(const char *name, JsonVariant *v, JsonDispatchFlags f t = rlimit_from_string(z); if (t < 0) - return json_log(v, flags, SYNTHETIC_ERRNO(EINVAL), + return json_log(v, flags, t, "rlimit name unknown: %s", json_variant_string(v)); *type = t; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index a702af8e3b..e1c55d0542 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1280,8 +1280,7 @@ static int parse_argv(int argc, char *argv[]) { arg_kill_signal = signal_from_string(optarg); if (arg_kill_signal < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Cannot parse signal: %s", optarg); + return log_error_errno(arg_kill_signal, "Cannot parse signal: %s", optarg); arg_settings_mask |= SETTING_KILL_SIGNAL; break; @@ -1443,8 +1442,7 @@ static int parse_argv(int argc, char *argv[]) { rl = rlimit_from_string_harder(name); if (rl < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Unknown resource limit: %s", name); + return log_error_errno(rl, "Unknown resource limit: %s", name); if (!arg_rlimit[rl]) { arg_rlimit[rl] = new0(struct rlimit, 1); @@ -1490,7 +1488,7 @@ static int parse_argv(int argc, char *argv[]) { arg_resolv_conf = resolv_conf_mode_from_string(optarg); if (arg_resolv_conf < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + return log_error_errno(arg_resolv_conf, "Failed to parse /etc/resolv.conf mode: %s", optarg); arg_settings_mask |= SETTING_RESOLV_CONF; @@ -1504,7 +1502,7 @@ static int parse_argv(int argc, char *argv[]) { arg_timezone = timezone_mode_from_string(optarg); if (arg_timezone < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + return log_error_errno(arg_timezone, "Failed to parse /etc/localtime mode: %s", optarg); arg_settings_mask |= SETTING_TIMEZONE; |