chiark / gitweb /
sd-login: fix return value of sd_pid_get_user_unit
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 May 2017 02:11:08 +0000 (22:11 -0400)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:46:52 +0000 (09:46 +0200)
E.g. "/user.slice/user-1000.slice/session-15.scope" would cause -ENXIO to be
returned.

src/libelogind/sd-login/sd-login.c

index 3adbb34..02cd8be 100644 (file)
@@ -78,12 +78,16 @@ _public_ int sd_pid_get_unit(pid_t pid, char **unit) {
 }
 
 _public_ int sd_pid_get_user_unit(pid_t pid, char **unit) {
+#if 0 /// UNNEEDED by elogind
+        int r;
+#endif // 0
 
         assert_return(pid >= 0, -EINVAL);
         assert_return(unit, -EINVAL);
 
 #if 0 /// elogind does not support systemd units
-        return cg_pid_get_user_unit(pid, unit);
+        r = cg_pid_get_user_unit(pid, unit);
+        return r == -ENXIO ? -ENODATA : r;
 #else
         return -ESRCH;
 #endif // 0