diff options
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 7827f063c1..961767c4a9 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -199,6 +199,9 @@ static int method_get_machine_by_pid(sd_bus_message *message, void *userdata, sd if (r < 0) return r; + if (pid < 0) + return -EINVAL; + if (pid == 0) { _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL; @@ -1505,7 +1508,7 @@ int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) { assert(pid >= 1); assert(machine); - mm = hashmap_get(m->machine_leaders, UINT_TO_PTR(pid)); + mm = hashmap_get(m->machine_leaders, PID_TO_PTR(pid)); if (!mm) { _cleanup_free_ char *unit = NULL; |