]> err.no Git - util-linux/commitdiff
wall: fix O_NONBLOCK usage
authorKarel Zak <kzak@redhat.com>
Mon, 2 Jul 2007 13:58:09 +0000 (15:58 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 2 Jul 2007 13:58:09 +0000 (15:58 +0200)
From: Alan Curry <pacman@TheWorld.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/ttymsg.c

index 55b26a82a02da18770900b33e8b223f555ee0a77..0dbe581130adf53bb753bbceb9f24a3b0d0a524e 100644 (file)
@@ -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;
                }
                /*