]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: don't use log_err() for non-fatal errors
authorKarel Zak <kzak@redhat.com>
Thu, 8 Dec 2011 10:39:05 +0000 (11:39 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 8 Dec 2011 11:54:49 +0000 (12:54 +0100)
The TIOCSCTTY ioctl requires that caller is session leader -- so it
depends on initd (or we have to add setsid() to aggety). It seems that the
traditional way is to setup tty in agetty and session in login(1).

It means that all session related things (TIOCSCTTY, vhangup, ...) in the
command agetty should be optional. (Note that vhangup() is called when
--hangup is explicitly specified on command line, so log_err() makes
sense there.)

Reported-by: Andrew Walrond <andrew@walrond.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/agetty.c

index 079a737f980d630f222200b0709744328ca70cc3..3500a8eeda8c46c0e35d398323cbbf4ab952d491 100644 (file)
@@ -925,7 +925,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)
 
                if (((tid = tcgetsid(fd)) < 0) || (pid != tid)) {
                        if (ioctl(fd, TIOCSCTTY, 1) == -1)
-                               log_err("/dev/%s: cannot get controlling tty: %m", tty);
+                               log_warn("/dev/%s: cannot get controlling tty: %m", tty);
                }
 
                if (op->flags & F_HANGUP) {
@@ -950,7 +950,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)
                        log_err(_("/dev/%s: cannot open as standard input: %m"), tty);
                if (((tid = tcgetsid(STDIN_FILENO)) < 0) || (pid != tid)) {
                        if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) == -1)
-                               log_err("/dev/%s: cannot get controlling tty: %m", tty);
+                               log_warn("/dev/%s: cannot get controlling tty: %m", tty);
                }
 
        } else {