diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-22 14:33:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-22 14:33:39 +0000 |
commit | 9c1254792ca4971b36d06706e9d51c253d96106d (patch) | |
tree | ea785c930b48f073e51c9c8a119d43081f42a3e5 /src/microhttpd/mhd_itc.c | |
parent | df6d586ac2f0f73bcd817638a1100bf5972faca9 (diff) | |
download | libmicrohttpd-9c1254792ca4971b36d06706e9d51c253d96106d.tar.gz libmicrohttpd-9c1254792ca4971b36d06706e9d51c253d96106d.zip |
raising MHD_Pipe API abstraction level in preparation for fixing #3557
Diffstat (limited to 'src/microhttpd/mhd_itc.c')
-rw-r--r-- | src/microhttpd/mhd_itc.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/microhttpd/mhd_itc.c b/src/microhttpd/mhd_itc.c index 4f8cf1b7..5611aa9f 100644 --- a/src/microhttpd/mhd_itc.c +++ b/src/microhttpd/mhd_itc.c | |||
@@ -38,25 +38,29 @@ | |||
38 | /** | 38 | /** |
39 | * Change itc FD options to be non-blocking. | 39 | * Change itc FD options to be non-blocking. |
40 | * | 40 | * |
41 | * @param fd the FD to manipulate | 41 | * @param pip the pipe to manipulate |
42 | * @return non-zero if succeeded, zero otherwise | 42 | * @return non-zero if succeeded, zero otherwise |
43 | */ | 43 | */ |
44 | int | 44 | int |
45 | MHD_itc_nonblocking_ (MHD_pipe fd) | 45 | MHD_itc_nonblocking_ (struct MHD_Pipe pip) |
46 | { | 46 | { |
47 | int flags; | 47 | unsigned int i; |
48 | 48 | ||
49 | flags = fcntl (fd, | 49 | for (i=0;i<2;i++) |
50 | F_GETFL); | 50 | { |
51 | if (-1 == flags) | 51 | int flags; |
52 | return 0; | ||
53 | 52 | ||
54 | if ( ((flags | O_NONBLOCK) != flags) && | 53 | flags = fcntl (pip.fd[i], |
55 | (0 != fcntl (fd, | 54 | F_GETFL); |
56 | F_SETFL, | 55 | if (-1 == flags) |
57 | flags | O_NONBLOCK)) ) | 56 | return 0; |
58 | return 0; | ||
59 | 57 | ||
58 | if ( ((flags | O_NONBLOCK) != flags) && | ||
59 | (0 != fcntl (pip.fd[i], | ||
60 | F_SETFL, | ||
61 | flags | O_NONBLOCK)) ) | ||
62 | return 0; | ||
63 | } | ||
60 | return !0; | 64 | return !0; |
61 | } | 65 | } |
62 | #endif /* _WIN32 && ! __CYGWIN__ */ | 66 | #endif /* _WIN32 && ! __CYGWIN__ */ |