]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: nicer error message when we cannot guess the caller's session
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 1 Jun 2017 02:10:15 +0000 (22:10 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 1 Jun 2017 02:10:15 +0000 (22:10 -0400)
Partial fix for #6032.

src/login/logind-dbus.c

index c6be596af31fe3f760c369b430788937444ca26c..c9b7d998189ecbbc27a492b5300142d82222c9d3 100644 (file)
@@ -65,6 +65,9 @@ int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const ch
                         return r;
 
                 r = sd_bus_creds_get_session(creds, &name);
+                if (r == -ENXIO)
+                        return sd_bus_error_setf(error, BUS_ERROR_NO_SESSION_FOR_PID,
+                                                 "Caller does not belong to any known session");
                 if (r < 0)
                         return r;
         }