gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] branch master updated: fix CID 164297: ensu


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: fix CID 164297: ensure -1 listen_fd is not passed to close
Date: Fri, 10 Mar 2017 16:24:42 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 667a974c fix CID 164297: ensure -1 listen_fd is not passed to close
667a974c is described below

commit 667a974ca7b8ad4ddc72a3feec6c005defd615dd
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Mar 10 16:26:24 2017 +0100

    fix CID 164297: ensure -1 listen_fd is not passed to close
---
 ChangeLog               | 5 +++++
 src/microhttpd/daemon.c | 8 +++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf8f331c..e3b9c29f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Mar 10 16:22:54 CET 2017
+       Handle case that we do not listen at all more gracefully
+       in MHD_start_daemon() and not pass '-1' to helper functions
+       that expect a valid socket. -CG
+
 Tue Mar  7 12:11:44 BRT 2017
        Updates file `.gitignore`.
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 600074d6..3499f211 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5454,7 +5454,8 @@ MHD_start_daemon_va (unsigned int flags,
       listen_fd = daemon->listen_fd;
     }
 
-  if (!MHD_socket_nonblocking_ (listen_fd))
+  if ( (MHD_INVALID_SOCKET != listen_fd) &&
+       (! MHD_socket_nonblocking_ (listen_fd)) )
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
@@ -5471,8 +5472,9 @@ MHD_start_daemon_va (unsigned int flags,
           goto free_and_fail;
         }
     }
-  if ( (!MHD_SCKT_FD_FITS_FDSET_(listen_fd,
-                                 NULL)) &&
+  if ( (MHD_INVALID_SOCKET != listen_fd) &&
+       (! MHD_SCKT_FD_FITS_FDSET_(listen_fd,
+                                  NULL)) &&
        (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
     {
 #ifdef HAVE_MESSAGES

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]