summaryrefslogtreecommitdiffstats
path: root/term-utils/agetty.c
diff options
context:
space:
mode:
authorKarel Zak2013-06-13 11:06:13 +0200
committerKarel Zak2013-06-13 11:30:02 +0200
commit714cff30fd94d7fe6c7a8c6a1b4aa6cc8abd2ca7 (patch)
tree61fde98614e7bf000b20eb0a9f79badedc8da215 /term-utils/agetty.c
parentfdisk: don't use ptes[] in generic code (diff)
downloadkernel-qcow2-util-linux-714cff30fd94d7fe6c7a8c6a1b4aa6cc8abd2ca7.tar.gz
kernel-qcow2-util-linux-714cff30fd94d7fe6c7a8c6a1b4aa6cc8abd2ca7.tar.xz
kernel-qcow2-util-linux-714cff30fd94d7fe6c7a8c6a1b4aa6cc8abd2ca7.zip
agetty: use O_NONBLOCK only for serial lines with CLOCAL
* regression introduced by ef264c830effc91add6da334204215f61eb8515e * also increase sleep when O_NONBLOCK used (grr.. this is so stupid thing, do we really need O_NONBLOCK for the stupid serial lines?) References: https://bugzilla.redhat.com/show_bug.cgi?id=972457 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/agetty.c')
-rw-r--r--term-utils/agetty.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 76f56eb00..054a1dd68 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -321,9 +321,10 @@ int main(int argc, char **argv)
strlen(options.initstring));
}
- if ((options.flags & F_VCONSOLE) == 0 &&
- options.clocal == CLOCAL_MODE_ALWAYS)
- /* Go to blocking write mode unless -L is specified. */
+ if (options.flags & F_VCONSOLE || options.clocal != CLOCAL_MODE_ALWAYS)
+ /* Go to blocking mode unless -L is specified, this change
+ * affects stdout, stdin and stderr as all the file descriptors
+ * are created by dup(). */
fcntl(STDOUT_FILENO, F_SETFL,
fcntl(STDOUT_FILENO, F_GETFL, 0) & ~O_NONBLOCK);
@@ -1449,9 +1450,10 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
if (read(STDIN_FILENO, &c, 1) < 1) {
- /* Do not report trivial like EINTR/EIO errors. */
+ /* The terminal could be open with O_NONBLOCK when
+ * -L (force CLOCAL) is specified... */
if (errno == EINTR || errno == EAGAIN) {
- usleep(1000);
+ usleep(250000);
continue;
}
switch (errno) {