summaryrefslogtreecommitdiffstats
path: root/login-utils/ttymsg.c
diff options
context:
space:
mode:
authorKarel Zak2007-07-02 15:58:09 +0200
committerKarel Zak2007-07-02 15:58:09 +0200
commita6f628832a1e6292cfdf9074ba32ba8cd21f899d (patch)
tree53da5c09c4142d2aeed417c46df6cd1fe76a66b1 /login-utils/ttymsg.c
parentcfdisk: fix stupid typo in GPT checker call (diff)
downloadkernel-qcow2-util-linux-a6f628832a1e6292cfdf9074ba32ba8cd21f899d.tar.gz
kernel-qcow2-util-linux-a6f628832a1e6292cfdf9074ba32ba8cd21f899d.tar.xz
kernel-qcow2-util-linux-a6f628832a1e6292cfdf9074ba32ba8cd21f899d.zip
wall: fix O_NONBLOCK usage
From: Alan Curry <pacman@TheWorld.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/ttymsg.c')
-rw-r--r--login-utils/ttymsg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/login-utils/ttymsg.c b/login-utils/ttymsg.c
index 55b26a82a..0dbe58113 100644
--- a/login-utils/ttymsg.c
+++ b/login-utils/ttymsg.c
@@ -127,7 +127,7 @@ ttymsg(struct iovec *iov, int iovcnt, char *line, int tmout) {
continue;
}
if (errno == EWOULDBLOCK) {
- int cpid, off = 0;
+ int cpid, flags;
if (forked) {
(void) close(fd);
@@ -155,7 +155,8 @@ ttymsg(struct iovec *iov, int iovcnt, char *line, int tmout) {
(void) signal(SIGTERM, SIG_DFL); /* XXX */
(void) sigsetmask(0);
(void) alarm((u_int)tmout);
- (void) fcntl(fd, O_NONBLOCK, &off);
+ flags = fcntl(fd, F_GETFL);
+ fcntl(flags, F_SETFL, (long) (flags & ~O_NONBLOCK));
continue;
}
/*