agetty: fix stdin conversion to tty name

Resolves: RHEL-153737
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2026-08-13 12:39:11 +02:00
parent 357f4a59d6
commit 94615e4bc1
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 6c292cb885be9ca778d999cd04db7c0a1a89b2be Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 24 Feb 2025 13:37:04 +0100
Subject: [PATCH] agetty: fix stdin conversion to tty name
Resolves: RHEL-153737
Addresses: https://github.com/util-linux/util-linux/issues/3304
Signed-off-by: Karel Zak <kzak@redhat.com>
Upstream: http://github.com/util-linux/util-linux/commit/bd6c104f931329ce6fbc5a1250c8c80a1d8223ee
---
term-utils/agetty.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index e65cbdeaf..6189a9bb3 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -921,11 +921,15 @@ static void parse_args(int argc, char **argv, struct options *op)
/* resolve the tty path in case it was provided as stdin */
if (strcmp(op->tty, "-") == 0) {
+ int fd;
+ const char *name = op->tty;
+
op->tty_is_stdin = 1;
- int fd = get_terminal_name(NULL, &op->tty, NULL);
- if (fd < 0) {
+ fd = get_terminal_name(NULL, &name, NULL);
+ if (fd >= 0)
+ op->tty = name; /* set real device name */
+ else
log_warn(_("could not get terminal name: %d"), fd);
- }
}
/* On virtual console remember the line which is used for */
--
2.55.0

View File

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.37.4
Release: 26%{?dist}
Release: 27%{?dist}
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
URL: http://en.wikipedia.org/wiki/Util-linux
@ -256,6 +256,8 @@ Patch88: 0088-login-utils-fix-setpwnam-buffer-use-CVE-2025-14104.patch
# RHEL-192480 - script: fix use of utempter (utmp registration)
Patch89: 0089-llib-pty-session-split-PTY-and-signalfd-setup.patch
Patch90: 0090-script-fix-use-of-utempter.patch
# RHEL-153737 - agetty: fix stdin conversion to tty name
Patch91: 0091-agetty-fix-stdin-conversion-to-tty-name.patch
%description
@ -1091,6 +1093,9 @@ fi
%{_libdir}/python*/site-packages/libmount/
%changelog
* Thu Aug 13 2026 Karel Zak <kzak@redhat.com> 2.37.4-27
- fix RHEL-153737 - agetty: fix stdin conversion to tty name
* Thu Jul 16 2026 Karel Zak <kzak@redhat.com> 2.37.4-26
- fix RHEL-192480 - script: fix use of utempter (utmp registration)