]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loginctl: enable-linger does not need fallback to XDG_SESSION_ID
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Mon, 18 Sep 2017 17:04:59 +0000 (18:04 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Tue, 14 Nov 2017 18:15:33 +0000 (18:15 +0000)
To maintain consistency with `loginctl user-status`, drop the fallback to
XDG_SESSION_ID for `loginctl enable-linger`.  The fallback was unnecessary
and also incorrect: it passed the numeric value of the session identifier
as a UID value.

src/login/loginctl.c

index a63174c093f14bd1bbe6bb4c00a1b914ff3794bf..e8d549278737c62391d25938976d2e8493577f83 100644 (file)
@@ -1164,11 +1164,11 @@ static int enable_linger(int argc, char *argv[], void *userdata) {
         b = streq(argv[0], "enable-linger");
 
         if (argc < 2) {
-                /* No argument? Let's either use $XDG_SESSION_ID (if specified), or an empty
-                 * session name, in which case logind will try to guess our session. */
+                /* No argument? Let's use an empty user name,
+                 * then logind will use our user. */
 
                 short_argv[0] = argv[0];
-                short_argv[1] = getenv("XDG_SESSION_ID") ?: (char*) "";
+                short_argv[1] = (char*) "";
                 short_argv[2] = NULL;
                 argv = short_argv;
                 argc = 2;