summaryrefslogtreecommitdiffstats
path: root/src/machine/machined-varlink.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-31 02:24:06 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-10-31 03:02:35 +0100
commit76423f301e671780c86e440161c4c7e3b1656f7e (patch)
treec6b29ea9b7ce3e4d319a50c6b88d91a566a85978 /src/machine/machined-varlink.c
parentmachine: use JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY() (diff)
downloadsystemd-76423f301e671780c86e440161c4c7e3b1656f7e.tar.xz
systemd-76423f301e671780c86e440161c4c7e3b1656f7e.zip
machine: lookup_machine_by_name_or_pidref() returns negative errno on failure
This effectively reverts d2c1451b7398f13439b694450a23def3cf31c8db. After the commit d2ebf5cc1d59e29139f06efaa3a9b2c184cdaa25, sd_varlink_error() returns negative errno, hence the function always return negative errno on failure.
Diffstat (limited to '')
-rw-r--r--src/machine/machined-varlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/machine/machined-varlink.c b/src/machine/machined-varlink.c
index 104958d4b8..151d06e5f4 100644
--- a/src/machine/machined-varlink.c
+++ b/src/machine/machined-varlink.c
@@ -526,7 +526,7 @@ static int vl_method_list(sd_varlink *link, sd_json_variant *parameters, sd_varl
r = lookup_machine_by_name_or_pidref(link, m, p.name, &p.pidref, &machine);
if (r == -ESRCH)
return sd_varlink_error(link, "io.systemd.Machine.NoSuchMachine", NULL);
- if (r != 0)
+ if (r < 0)
return r;
return list_machine_one_and_maybe_read_metadata(link, machine, /* more = */ false, p.acquire_metadata);
@@ -576,7 +576,7 @@ static int lookup_machine_and_call_method(sd_varlink *link, sd_json_variant *par
r = lookup_machine_by_name_or_pidref(link, manager, p.name, &p.pidref, &machine);
if (r == -ESRCH)
return sd_varlink_error(link, "io.systemd.Machine.NoSuchMachine", NULL);
- if (r != 0)
+ if (r < 0)
return r;
return method(link, parameters, flags, machine);