From: Karel Zak Date: Mon, 2 Jul 2007 13:58:09 +0000 (+0200) Subject: wall: fix O_NONBLOCK usage X-Git-Tag: v2.13-rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6f628832a1e6292cfdf9074ba32ba8cd21f899d;p=thirdparty%2Futil-linux.git wall: fix O_NONBLOCK usage From: Alan Curry Signed-off-by: Karel Zak --- diff --git a/login-utils/ttymsg.c b/login-utils/ttymsg.c index 55b26a82a0..0dbe581130 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; } /*