diff options
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index c095943e8b..81c48a6e5c 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_sock.c,v 1.56 2014/07/16 10:43:06 deraadt Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.57 2014/10/13 02:39:09 bcook Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -65,6 +65,7 @@ | |||
65 | #include <netinet/tcp.h> | 65 | #include <netinet/tcp.h> |
66 | 66 | ||
67 | #include <errno.h> | 67 | #include <errno.h> |
68 | #include <fcntl.h> | ||
68 | #include <limits.h> | 69 | #include <limits.h> |
69 | #include <netdb.h> | 70 | #include <netdb.h> |
70 | #include <stdio.h> | 71 | #include <stdio.h> |
@@ -459,5 +460,10 @@ BIO_set_tcp_ndelay(int s, int on) | |||
459 | int | 460 | int |
460 | BIO_socket_nbio(int s, int mode) | 461 | BIO_socket_nbio(int s, int mode) |
461 | { | 462 | { |
462 | return (BIO_socket_ioctl(s, FIONBIO, &mode) == 0); | 463 | int flags = fcntl(s, F_GETFD); |
464 | if (mode && !(flags & O_NONBLOCK)) | ||
465 | return (fcntl(s, F_SETFL, flags | O_NONBLOCK) == 0); | ||
466 | else if (!mode && (flags & O_NONBLOCK)) | ||
467 | return (fcntl(s, F_SETFL, flags & ~O_NONBLOCK) == 0); | ||
468 | return (1); | ||
463 | } | 469 | } |