chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Mon, 18 Sep 2017 17:04:59 +0000 (18:04 +0100)
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 4948d2ee7622e8542b7ac2bcbdee04f3795058dc..6fe70b7141e304fdbc7a0e7706c94ea7473f4406 100644 (file)
@@ -1186,11 +1186,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;