From: Karel Zak Date: Tue, 13 May 2014 10:28:48 +0000 (+0200) Subject: agetty: fix odd check for chardev/tty X-Git-Tag: v2.25-rc1~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b351394223c2f8fd30ead67b167d76f9a956a4;p=thirdparty%2Futil-linux.git agetty: fix odd check for chardev/tty References: https://bugzilla.redhat.com/show_bug.cgi?id=1069902 Signed-off-by: Karel Zak --- diff --git a/term-utils/agetty.c b/term-utils/agetty.c index a70683617a..5163550fbd 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)