diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-23 14:06:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-23 14:06:50 +0000 |
commit | c63ac7db4ebc38713aa5d5e2edf52c27200003d8 (patch) | |
tree | 10c1f9e6f2d13b9f259ff82cee4df31278bb80c2 /src/microhttpd/mhd_itc.h | |
parent | c622e75b5835dcee9f47eaf7298b1537ae7f0369 (diff) | |
download | libmicrohttpd-c63ac7db4ebc38713aa5d5e2edf52c27200003d8.tar.gz libmicrohttpd-c63ac7db4ebc38713aa5d5e2edf52c27200003d8.zip |
-check close() return value
Diffstat (limited to 'src/microhttpd/mhd_itc.h')
-rw-r--r-- | src/microhttpd/mhd_itc.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h index 58aab395..3a05c4ec 100644 --- a/src/microhttpd/mhd_itc.h +++ b/src/microhttpd/mhd_itc.h | |||
@@ -86,7 +86,9 @@ MHD_pipe_write_ (struct MHD_Pipe pip, | |||
86 | * Close any FDs of the pipe (non-W32) | 86 | * Close any FDs of the pipe (non-W32) |
87 | */ | 87 | */ |
88 | #define MHD_pipe_close_(pip) do { \ | 88 | #define MHD_pipe_close_(pip) do { \ |
89 | close (pip.event_fd); \ | 89 | if ( (0 != close (pip.event_fd)) && \ |
90 | (EBADF == errno) ) \ | ||
91 | MHD_PANIC (_("close failed")); \ | ||
90 | } while (0) | 92 | } while (0) |
91 | 93 | ||
92 | /** | 94 | /** |
@@ -167,8 +169,12 @@ struct MHD_Pipe | |||
167 | * Close any FDs of the pipe (non-W32) | 169 | * Close any FDs of the pipe (non-W32) |
168 | */ | 170 | */ |
169 | #define MHD_pipe_close_(pip) do { \ | 171 | #define MHD_pipe_close_(pip) do { \ |
170 | close (pip.fd[0]); \ | 172 | if ( (0 != close (pip.fd[0])) && \ |
171 | close (pip.fd[1]); \ | 173 | (EBADF == errno) ) \ |
174 | MHD_PANIC (_("close failed")); \ | ||
175 | if ( (0 != close (pip.fd[1])) && \ | ||
176 | (EBADF == errno) ) \ | ||
177 | MHD_PANIC (_("close failed")); \ | ||
172 | } while (0) | 178 | } while (0) |
173 | 179 | ||
174 | /** | 180 | /** |
@@ -239,8 +245,8 @@ struct MHD_Pipe | |||
239 | * Close emulated pipe FDs | 245 | * Close emulated pipe FDs |
240 | */ | 246 | */ |
241 | #define MHD_pipe_close_(fd) do { \ | 247 | #define MHD_pipe_close_(fd) do { \ |
242 | MHD_socket_close_(pip.fd[0]); \ | 248 | MHD_socket_close_ (pip.fd[0]); \ |
243 | MHD_socket_close_(pip.fd[1]); \ | 249 | MHD_socket_close_ (pip.fd[1]); \ |
244 | } while (0) | 250 | } while (0) |
245 | 251 | ||
246 | /** | 252 | /** |