libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c63ac7db4ebc38713aa5d5e2edf52c27200003d8
parent c622e75b5835dcee9f47eaf7298b1537ae7f0369
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 23 Sep 2016 14:06:50 +0000

-check close() return value

Diffstat:
Msrc/microhttpd/mhd_itc.h | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h @@ -86,7 +86,9 @@ MHD_pipe_write_ (struct MHD_Pipe pip, * Close any FDs of the pipe (non-W32) */ #define MHD_pipe_close_(pip) do { \ - close (pip.event_fd); \ + if ( (0 != close (pip.event_fd)) && \ + (EBADF == errno) ) \ + MHD_PANIC (_("close failed")); \ } while (0) /** @@ -167,8 +169,12 @@ struct MHD_Pipe * Close any FDs of the pipe (non-W32) */ #define MHD_pipe_close_(pip) do { \ - close (pip.fd[0]); \ - close (pip.fd[1]); \ + if ( (0 != close (pip.fd[0])) && \ + (EBADF == errno) ) \ + MHD_PANIC (_("close failed")); \ + if ( (0 != close (pip.fd[1])) && \ + (EBADF == errno) ) \ + MHD_PANIC (_("close failed")); \ } while (0) /** @@ -239,8 +245,8 @@ struct MHD_Pipe * Close emulated pipe FDs */ #define MHD_pipe_close_(fd) do { \ - MHD_socket_close_(pip.fd[0]); \ - MHD_socket_close_(pip.fd[1]); \ + MHD_socket_close_ (pip.fd[0]); \ + MHD_socket_close_ (pip.fd[1]); \ } while (0) /**