diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 030131eeda3..cd844b3105b 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -74,11 +74,13 @@ _public_ int sd_pid_get_unit(pid_t pid, char **unit) { } _public_ int sd_pid_get_user_unit(pid_t pid, char **unit) { + int r; assert_return(pid >= 0, -EINVAL); assert_return(unit, -EINVAL); - return cg_pid_get_user_unit(pid, unit); + r = cg_pid_get_user_unit(pid, unit); + return r == -ENXIO ? -ENODATA : r; } _public_ int sd_pid_get_machine_name(pid_t pid, char **name) {