summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2016-03-20 01:33:39 +0000
committermillert <millert@openbsd.org>2016-03-20 01:33:39 +0000
commitdf4bf4b784593fa92ec2bee64f7fbf62b7dd5497 (patch)
tree72cfdaf2be9fad4591be1dd7ed8a71285efb7f26
parentRevert, missing decl for in6_pcbaddrisavail() breaks kernel build. (diff)
downloadwireguard-openbsd-df4bf4b784593fa92ec2bee64f7fbf62b7dd5497.tar.xz
wireguard-openbsd-df4bf4b784593fa92ec2bee64f7fbf62b7dd5497.zip
Use fcntl(fd, F_SETFL, flags) to clear O_NONBLOCK instead of
ioctl(fd, FIONBIO, ...). OK krw@
-rw-r--r--bin/csh/lex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/csh/lex.c b/bin/csh/lex.c
index 72f0a8301f3..c206b05558d 100644
--- a/bin/csh/lex.c
+++ b/bin/csh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.21 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: lex.c,v 1.22 2016/03/20 01:33:39 millert Exp $ */
/* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */
/*-
@@ -31,9 +31,9 @@
*/
#include <sys/types.h>
-#include <sys/ioctl.h>
#include <termios.h>
#include <errno.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -1453,9 +1453,10 @@ again:
if (c >= 0)
break;
if (errno == EWOULDBLOCK) {
- int off = 0;
+ int flags;
- (void) ioctl(SHIN, FIONBIO, (ioctl_t) & off);
+ flags = fcntl(SHIN, F_GETFL, 0);
+ (void) fcntl(SHIN, F_SETFL, (flags & ~O_NONBLOCK));
}
else if (errno != EINTR)
break;