]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: make sure we don't get confused when setting TERM for a tty fd
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Apr 2020 19:52:22 +0000 (21:52 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 Apr 2020 20:59:41 +0000 (22:59 +0200)
Fixes: #15344
src/core/execute.c

index 5b9c30c82aa409c3e2d226b6719b7d001a4755e0..b5f77a15e41d412896cea82bbe82950b6acf587e 100644 (file)
@@ -1820,12 +1820,13 @@ static int build_environment(
 
                 tty_path = exec_context_tty_path(c);
 
-                /* If we are forked off PID 1 and we are supposed to operate on /dev/console, then let's try to inherit
-                 * the $TERM set for PID 1. This is useful for containers so that the $TERM the container manager
-                 * passes to PID 1 ends up all the way in the console login shown. */
+                /* If we are forked off PID 1 and we are supposed to operate on /dev/console, then let's try
+                 * to inherit the $TERM set for PID 1. This is useful for containers so that the $TERM the
+                 * container manager passes to PID 1 ends up all the way in the console login shown. */
 
-                if (path_equal(tty_path, "/dev/console") && getppid() == 1)
+                if (path_equal_ptr(tty_path, "/dev/console") && getppid() == 1)
                         term = getenv("TERM");
+
                 if (!term)
                         term = default_term_for_tty(tty_path);