From c6b351394223c2f8fd30ead67b167d76f9a956a4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 13 May 2014 12:28:48 +0200 Subject: agetty: fix odd check for chardev/tty References: https://bugzilla.redhat.com/show_bug.cgi?id=1069902 Signed-off-by: Karel Zak --- term-utils/agetty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'term-utils') diff --git a/term-utils/agetty.c b/term-utils/agetty.c index a70683617..5163550fb 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -975,12 +975,12 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) log_err(_("/dev/%s: cannot open as standard input: %m"), tty); /* Sanity checks... */ - if (!isatty(fd)) - log_err(_("/dev/%s: not a character device"), tty); if (fstat(fd, &st) < 0) log_err("%s: %m", buf); if ((st.st_mode & S_IFMT) != S_IFCHR) log_err(_("/dev/%s: not a character device"), tty); + if (!isatty(fd)) + log_err(_("/dev/%s: not a tty"), tty); if (((tid = tcgetsid(fd)) < 0) || (pid != tid)) { if (ioctl(fd, TIOCSCTTY, 1) == -1) -- cgit v1.2.3-55-g7522