]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: Don't override TERM passed by the user
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 19 Apr 2024 18:07:47 +0000 (20:07 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 19 Apr 2024 18:09:59 +0000 (20:09 +0200)
Before 4869b259d68f65ea88df625ce8df9c0177d55a01, any TERM passed
on the agetty command line would be used instead of the default TERM.
After 4869b259d68f65ea88df625ce8df9c0177d55a01, the default TERM is
used unconditionally.

Fix the regression by checking if the user passed a custom TERM.

Fixes: 4869b259d68f65ea88df625ce8df9c0177d55a01
term-utils/agetty.c

index ff5123dbf630f0626664e1ebc1767e984d7e257b..6d461b6f1f8e4871927ba1bb52d28c80f084e276 100644 (file)
@@ -1196,7 +1196,8 @@ static void open_tty(const char *tty, struct termios *tp, struct options *op)
 #endif
        }
 
-       op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE));
+       if (!op->term)
+               op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE));
        if (!op->term)
                log_err(_("failed to allocate memory: %m"));