gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r38104 - in libmicrohttpd/src: microhttpd testcurl testcurl


From: gnunet
Subject: [GNUnet-SVN] r38104 - in libmicrohttpd/src: microhttpd testcurl testcurl/https
Date: Tue, 11 Oct 2016 17:20:40 +0200

Author: Karlson2k
Date: 2016-10-11 17:20:40 +0200 (Tue, 11 Oct 2016)
New Revision: 38104

Modified:
   libmicrohttpd/src/microhttpd/connection.c
   libmicrohttpd/src/microhttpd/daemon.c
   libmicrohttpd/src/microhttpd/digestauth.c
   libmicrohttpd/src/microhttpd/internal.h
   libmicrohttpd/src/microhttpd/mhd_itc.h
   libmicrohttpd/src/microhttpd/mhd_locks.h
   libmicrohttpd/src/microhttpd/mhd_sockets.h
   libmicrohttpd/src/microhttpd/response.c
   libmicrohttpd/src/microhttpd/test_shutdown_select.c
   libmicrohttpd/src/microhttpd/test_upgrade_common.c
   libmicrohttpd/src/microhttpd/test_upgrade_ssl.c
   libmicrohttpd/src/testcurl/https/test_https_time_out.c
   libmicrohttpd/src/testcurl/https/test_tls_extensions.c
   libmicrohttpd/src/testcurl/test_get.c
   libmicrohttpd/src/testcurl/test_quiesce.c
Log:
Refactored mhd_locks.h and mhd_sockets.h: allow usage of macros without
aborting of execution.

Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c   2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/connection.c   2016-10-11 15:20:40 UTC (rev 
38104)
@@ -614,7 +614,7 @@
     {
       /* either error or http 1.0 transfer, close socket! */
       response->total_size = connection->response_write_position;
-      MHD_mutex_unlock_ (&response->mutex);
+      MHD_mutex_unlock_chk_ (&response->mutex);
       if ( ((ssize_t)MHD_CONTENT_READER_END_OF_STREAM) == ret)
        MHD_connection_close_ (connection,
                                MHD_REQUEST_TERMINATED_COMPLETED_OK);
@@ -628,7 +628,7 @@
   if (0 == ret)
     {
       connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY;
-      MHD_mutex_unlock_ (&response->mutex);
+      MHD_mutex_unlock_chk_ (&response->mutex);
       return MHD_NO;
     }
   return MHD_YES;
@@ -2457,7 +2457,7 @@
             uint64_t data_write_offset;
 
             if (NULL != response->crc)
-              MHD_mutex_lock_ (&response->mutex);
+              MHD_mutex_lock_chk_ (&response->mutex);
             if (MHD_YES != try_ready_normal_body (connection))
               {
                 /* mutex was already unlocked by try_ready_normal_body */
@@ -2483,7 +2483,7 @@
                                        response->data_start]);
 #endif
             if (NULL != response->crc)
-              MHD_mutex_unlock_ (&response->mutex);
+              MHD_mutex_unlock_chk_ (&response->mutex);
             if (ret < 0)
               {
                 if (MHD_SCKT_ERR_IS_EINTR_ (err) ||
@@ -2569,7 +2569,7 @@
     }
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     {
-      MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
     }
   else
     {
@@ -2597,7 +2597,7 @@
   connection->resuming = MHD_NO;
   connection->in_idle = MHD_NO;
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_(&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_(&daemon->cleanup_connection_mutex);
 }
 
 
@@ -2906,11 +2906,11 @@
           break;
         case MHD_CONNECTION_NORMAL_BODY_UNREADY:
           if (NULL != connection->response->crc)
-            MHD_mutex_lock_ (&connection->response->mutex);
+            MHD_mutex_lock_chk_ (&connection->response->mutex);
           if (0 == connection->response->total_size)
             {
               if (NULL != connection->response->crc)
-                MHD_mutex_unlock_ (&connection->response->mutex);
+                MHD_mutex_unlock_chk_ (&connection->response->mutex);
               connection->state = MHD_CONNECTION_BODY_SENT;
               continue;
             }
@@ -2917,7 +2917,7 @@
           if (MHD_YES == try_ready_normal_body (connection))
             {
              if (NULL != connection->response->crc)
-               MHD_mutex_unlock_ (&connection->response->mutex);
+               MHD_mutex_unlock_chk_ (&connection->response->mutex);
               connection->state = MHD_CONNECTION_NORMAL_BODY_READY;
               /* Buffering for flushable socket was already enabled*/
               if (MHD_NO == socket_flush_possible (connection))
@@ -2932,13 +2932,13 @@
           break;
         case MHD_CONNECTION_CHUNKED_BODY_UNREADY:
           if (NULL != connection->response->crc)
-            MHD_mutex_lock_ (&connection->response->mutex);
+            MHD_mutex_lock_chk_ (&connection->response->mutex);
           if ( (0 == connection->response->total_size) ||
                (connection->response_write_position ==
                 connection->response->total_size) )
             {
               if (NULL != connection->response->crc)
-                MHD_mutex_unlock_ (&connection->response->mutex);
+                MHD_mutex_unlock_chk_ (&connection->response->mutex);
               connection->state = MHD_CONNECTION_BODY_SENT;
               continue;
             }
@@ -2945,7 +2945,7 @@
           if (MHD_YES == try_ready_chunked_body (connection))
             {
               if (NULL != connection->response->crc)
-                MHD_mutex_unlock_ (&connection->response->mutex);
+                MHD_mutex_unlock_chk_ (&connection->response->mutex);
               connection->state = MHD_CONNECTION_CHUNKED_BODY_READY;
               /* Buffering for flushable socket was already enabled */
               if (MHD_NO == socket_flush_possible (connection))
@@ -2953,7 +2953,7 @@
               continue;
             }
           if (NULL != connection->response->crc)
-            MHD_mutex_unlock_ (&connection->response->mutex);
+            MHD_mutex_unlock_chk_ (&connection->response->mutex);
           break;
         case MHD_CONNECTION_BODY_SENT:
           if (MHD_NO == build_header_response (connection))

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/daemon.c       2016-10-11 15:20:40 UTC (rev 
38104)
@@ -195,7 +195,7 @@
 static void
 MHD_ip_count_lock (struct MHD_Daemon *daemon)
 {
-  MHD_mutex_lock_(&daemon->per_ip_connection_mutex);
+  MHD_mutex_lock_chk_(&daemon->per_ip_connection_mutex);
 }
 
 
@@ -207,7 +207,7 @@
 static void
 MHD_ip_count_unlock (struct MHD_Daemon *daemon)
 {
-  MHD_mutex_unlock_(&daemon->per_ip_connection_mutex);
+  MHD_mutex_unlock_chk_(&daemon->per_ip_connection_mutex);
 }
 
 
@@ -962,7 +962,7 @@
                             NULL)) )
         MHD_PANIC (_("Failed to remove FD from epoll set\n"));
 #endif
-      MHD_socket_close_ (urh->mhd.socket);
+      MHD_socket_close_chk_ (urh->mhd.socket);
     }
   MHD_resume_connection (connection);
   MHD_connection_close_ (connection,
@@ -1532,7 +1532,7 @@
     {
       shutdown (con->socket_fd,
                 SHUT_WR);
-      MHD_socket_close_ (con->socket_fd);
+      MHD_socket_close_chk_ (con->socket_fd);
       con->socket_fd = MHD_INVALID_SOCKET;
     }
   return (MHD_THRD_RTRN_TYPE_) 0;
@@ -1771,7 +1771,7 @@
                                             external_add);
         }
       /* all pools are at their connection limit, must refuse */
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
 #if ENFILE
       errno = ENFILE;
 #endif
@@ -1788,7 +1788,7 @@
                (int) client_socket,
                (int) FD_SETSIZE);
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
 #if EINVAL
       errno = EINVAL;
 #endif
@@ -1813,7 +1813,7 @@
       MHD_DLOG (daemon,
                 _("Server reached connection limit. Closing inbound 
connection.\n"));
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
 #if ENFILE
       errno = ENFILE;
 #endif
@@ -1832,7 +1832,7 @@
                 _("Connection rejected by application. Closing 
connection.\n"));
 #endif
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
       MHD_ip_limit_del (daemon,
                         addr,
                         addrlen);
@@ -1862,7 +1862,7 @@
                "Error allocating memory: %s\n",
                MHD_strerror_ (errno));
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
       MHD_ip_limit_del (daemon,
                         addr,
                         addrlen);
@@ -1880,7 +1880,7 @@
                _("Error allocating memory: %s\n"),
                MHD_strerror_ (errno));
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
       MHD_ip_limit_del (daemon,
                         addr,
                         addrlen);
@@ -1900,7 +1900,7 @@
                _("Error allocating memory: %s\n"),
                MHD_strerror_ (errno));
 #endif
-      MHD_socket_close_ (client_socket);
+      MHD_socket_close_chk_ (client_socket);
       MHD_ip_limit_del (daemon,
                         addr,
                         addrlen);
@@ -1961,7 +1961,7 @@
                     _("Failed to setup TLS credentials: unknown credential 
type %d\n"),
                     daemon->cred_type);
 #endif
-          MHD_socket_close_ (client_socket);
+          MHD_socket_close_chk_ (client_socket);
           MHD_ip_limit_del (daemon,
                             addr,
                             addrlen);
@@ -1988,7 +1988,7 @@
 
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
   {
-    MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
   }
   else
   {
@@ -2000,7 +2000,7 @@
              daemon->connections_tail,
              connection);
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
 
   if (NULL != daemon->notify_connection)
     daemon->notify_connection (daemon->notify_connection_cls,
@@ -2080,13 +2080,13 @@
                                connection,
                                &connection->socket_context,
                                MHD_CONNECTION_NOTIFY_CLOSED);
-  MHD_socket_close_ (client_socket);
+  MHD_socket_close_chk_ (client_socket);
   MHD_ip_limit_del (daemon,
                     addr,
                     addrlen);
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     {
-      MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
     }
   else
     {
@@ -2098,7 +2098,7 @@
              daemon->connections_tail,
              connection);
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
   MHD_pool_destroy (connection->pool);
   free (connection->addr);
   free (connection);
@@ -2144,7 +2144,7 @@
     MHD_PANIC (_("Cannot suspend connections without enabling 
MHD_USE_SUSPEND_RESUME!\n"));
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     {
-      MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
     }
   else
     {
@@ -2187,7 +2187,7 @@
 #endif
   connection->suspended = MHD_YES;
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
 }
 
 
@@ -2208,7 +2208,7 @@
   if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME))
     MHD_PANIC (_("Cannot resume connections without enabling 
MHD_USE_SUSPEND_RESUME!\n"));
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
   connection->resuming = MHD_YES;
   daemon->resuming = MHD_YES;
   if ( (! MHD_INVALID_PIPE_(daemon->wpipe)) &&
@@ -2220,7 +2220,7 @@
 #endif
     }
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
 }
 
 
@@ -2240,7 +2240,7 @@
 
   ret = MHD_NO;
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
   if (MHD_NO != daemon->resuming)
     next = daemon->suspended_connections_head;
 
@@ -2295,7 +2295,7 @@
       pos->resuming = MHD_NO;
     }
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
   return ret;
 }
 
@@ -2424,7 +2424,7 @@
 #endif
       if (MHD_INVALID_SOCKET != s)
         {
-          MHD_socket_close_ (s);
+          MHD_socket_close_chk_ (s);
         }
       if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
         {
@@ -2499,7 +2499,7 @@
   struct MHD_Connection *pos;
 
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
   while (NULL != (pos = daemon->cleanup_head))
     {
       DLL_remove (daemon->cleanup_head,
@@ -2565,7 +2565,7 @@
        }
       if (MHD_INVALID_SOCKET != pos->socket_fd)
        {
-         MHD_socket_close_ (pos->socket_fd);
+         MHD_socket_close_chk_ (pos->socket_fd);
        }
       if (NULL != pos->addr)
        free (pos->addr);
@@ -2572,7 +2572,7 @@
       free (pos);
     }
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
 }
 
 
@@ -4791,7 +4791,7 @@
                     (unsigned int) port,
                     MHD_socket_last_strerr_ ());
 #endif
-         MHD_socket_close_ (socket_fd);
+         MHD_socket_close_chk_ (socket_fd);
          goto free_and_fail;
        }
 #ifdef TCP_FASTOPEN
@@ -4821,7 +4821,7 @@
                     _("Failed to listen for connections: %s\n"),
                     MHD_socket_last_strerr_ ());
 #endif
-         MHD_socket_close_ (socket_fd);
+         MHD_socket_close_chk_ (socket_fd);
          goto free_and_fail;
        }
     }
@@ -4843,7 +4843,7 @@
            /* Accept must be non-blocking. Multiple children may wake up
             * to handle a new connection, but only one will win the race.
             * The others must immediately return. */
-          MHD_socket_close_ (socket_fd);
+          MHD_socket_close_chk_ (socket_fd);
           goto free_and_fail;
         }
     }
@@ -4857,7 +4857,7 @@
                 socket_fd,
                 FD_SETSIZE);
 #endif
-      MHD_socket_close_ (socket_fd);
+      MHD_socket_close_chk_ (socket_fd);
       goto free_and_fail;
     }
 
@@ -4895,7 +4895,7 @@
                 _("MHD failed to initialize IP connection limit mutex\n"));
 #endif
       if (MHD_INVALID_SOCKET != socket_fd)
-        MHD_socket_close_ (socket_fd);
+        MHD_socket_close_chk_ (socket_fd);
       goto free_and_fail;
     }
   if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex))
@@ -4904,9 +4904,9 @@
       MHD_DLOG (daemon,
                 _("MHD failed to initialize IP connection limit mutex\n"));
 #endif
-      MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
       if (MHD_INVALID_SOCKET != socket_fd)
-        MHD_socket_close_ (socket_fd);
+        MHD_socket_close_chk_ (socket_fd);
       goto free_and_fail;
     }
 
@@ -4920,9 +4920,9 @@
                _("Failed to initialize TLS support\n"));
 #endif
       if (MHD_INVALID_SOCKET != socket_fd)
-        MHD_socket_close_ (socket_fd);
-      MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
-      MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
+        MHD_socket_close_chk_ (socket_fd);
+      MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
       goto free_and_fail;
     }
 #endif
@@ -4942,10 +4942,10 @@
                 _("Failed to create listen thread: %s\n"),
                MHD_strerror_ (errno));
 #endif
-      MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
-      MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
+      MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
       if (MHD_INVALID_SOCKET != socket_fd)
-        MHD_socket_close_ (socket_fd);
+        MHD_socket_close_chk_ (socket_fd);
       goto free_and_fail;
     }
   if ( (daemon->worker_pool_size > 0) &&
@@ -5050,7 +5050,7 @@
 #endif
               /* Free memory for this worker; cleanup below handles
                * all previously-created workers. */
-              MHD_mutex_destroy_ (&d->cleanup_connection_mutex);
+              MHD_mutex_destroy_chk_ (&d->cleanup_connection_mutex);
               goto thread_failed;
             }
         }
@@ -5071,9 +5071,9 @@
   if (0 == i)
     {
       if (MHD_INVALID_SOCKET != socket_fd)
-        MHD_socket_close_ (socket_fd);
-      MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
-      MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
+        MHD_socket_close_chk_ (socket_fd);
+      MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
+      MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
       if (NULL != daemon->worker_pool)
         free (daemon->worker_pool);
       goto free_and_fail;
@@ -5111,7 +5111,7 @@
 #endif
 #ifdef DAUTH_SUPPORT
   free (daemon->nnc);
-  MHD_mutex_destroy_ (&daemon->nnc_lock);
+  MHD_mutex_destroy_chk_ (&daemon->nnc_lock);
 #endif
 #if HTTPS_SUPPORT
   if (0 != (flags & MHD_USE_SSL))
@@ -5177,7 +5177,7 @@
   /* first, make sure all threads are aware of shutdown; need to
      traverse DLLs in peace... */
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_lock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
   if (NULL != daemon->suspended_connections_head)
     MHD_PANIC (_("MHD_stop_daemon() called while we have suspended 
connections.\n"));
   for (pos = daemon->connections_head; NULL != pos; pos = pos->next)
@@ -5191,7 +5191,7 @@
 #endif
     }
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
-    MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex);
+    MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
 
   /* now, collect per-connection threads */
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -5333,13 +5333,13 @@
          if (!MHD_join_thread_ (daemon->worker_pool[i].pid))
             MHD_PANIC (_("Failed to join a thread\n"));
          close_all_connections (&daemon->worker_pool[i]);
-         MHD_mutex_destroy_ (&daemon->worker_pool[i].cleanup_connection_mutex);
+         MHD_mutex_destroy_chk_ 
(&daemon->worker_pool[i].cleanup_connection_mutex);
 #ifdef EPOLL_SUPPORT
          if (-1 != daemon->worker_pool[i].epoll_fd)
-            MHD_socket_close_ (daemon->worker_pool[i].epoll_fd);
+            MHD_socket_close_chk_ (daemon->worker_pool[i].epoll_fd);
 #if HTTPS_SUPPORT
          if (-1 != daemon->worker_pool[i].epoll_upgrade_fd)
-            MHD_socket_close_ (daemon->worker_pool[i].epoll_upgrade_fd);
+            MHD_socket_close_chk_ (daemon->worker_pool[i].epoll_upgrade_fd);
 #endif
 #endif
           /* Individual pipes are always used */
@@ -5368,7 +5368,7 @@
     }
   close_all_connections (daemon);
   if (MHD_INVALID_SOCKET != fd)
-    MHD_socket_close_ (fd);
+    MHD_socket_close_chk_ (fd);
 
   /* TLS clean up */
 #if HTTPS_SUPPORT
@@ -5387,20 +5387,20 @@
 #ifdef EPOLL_SUPPORT
   if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
        (-1 != daemon->epoll_fd) )
-    MHD_socket_close_ (daemon->epoll_fd);
+    MHD_socket_close_chk_ (daemon->epoll_fd);
 #if HTTPS_SUPPORT
   if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
        (-1 != daemon->epoll_upgrade_fd) )
-    MHD_socket_close_ (daemon->epoll_upgrade_fd);
+    MHD_socket_close_chk_ (daemon->epoll_upgrade_fd);
 #endif
 #endif
 
 #ifdef DAUTH_SUPPORT
   free (daemon->nnc);
-  MHD_mutex_destroy_ (&daemon->nnc_lock);
+  MHD_mutex_destroy_chk_ (&daemon->nnc_lock);
 #endif
-  MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
-  MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
+  MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
+  MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex);
 
   if (! MHD_INVALID_PIPE_(daemon->wpipe))
     MHD_pipe_close_ (daemon->wpipe);
@@ -5654,7 +5654,7 @@
 static int
 gcry_w32_mutex_destroy (void **ppmtx)
 {
-  int res = (MHD_mutex_destroy_ ((MHD_mutex_*)*ppmtx)) ? 0 : 1;
+  int res = (MHD_mutex_destroy_chk_ ((MHD_mutex_*)*ppmtx)) ? 0 : 1;
   free (*ppmtx);
   return res;
 }
@@ -5663,7 +5663,7 @@
 static int
 gcry_w32_mutex_lock (void **ppmtx)
 {
-  MHD_mutex_lock_ ((MHD_mutex_*)*ppmtx);
+  MHD_mutex_lock_chk_ ((MHD_mutex_*)*ppmtx);
   return 0;
 }
 
@@ -5671,7 +5671,7 @@
 static int
 gcry_w32_mutex_unlock (void **ppmtx)
 {
-  MHD_mutex_unlock_ ((MHD_mutex_*)*ppmtx);
+  MHD_mutex_unlock_chk_ ((MHD_mutex_*)*ppmtx);
   return 0;
 }
 

Modified: libmicrohttpd/src/microhttpd/digestauth.c
===================================================================
--- libmicrohttpd/src/microhttpd/digestauth.c   2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/digestauth.c   2016-10-11 15:20:40 UTC (rev 
38104)
@@ -408,7 +408,7 @@
    * then only increase the nonce counter by one.
    */
   nn = &daemon->nnc[off];
-  MHD_mutex_lock_ (&daemon->nnc_lock);
+  MHD_mutex_lock_chk_ (&daemon->nnc_lock);
   if (0 == nc)
     {
       /* Fresh nonce, reinitialize array */
@@ -416,7 +416,7 @@
               nonce);
       nn->nc = 0;
       nn->nmask = 0;
-      MHD_mutex_unlock_ (&daemon->nnc_lock);
+      MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
       return MHD_YES;
     }
   /* Note that we use 64 here, as we do not store the
@@ -428,7 +428,7 @@
     {
       /* Out-of-order nonce, but within 64-bit bitmask, set bit */
       nn->nmask |= (1LLU < (nn->nc - nc - 1));
-      MHD_mutex_unlock_ (&daemon->nnc_lock);
+      MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
       return MHD_YES;
     }
 
@@ -437,7 +437,7 @@
                      nonce)) )
     {
       /* Nonce does not match, fail */
-      MHD_mutex_unlock_ (&daemon->nnc_lock);
+      MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
                _("Stale nonce received.  If this happens a lot, you should 
probably increase the size of the nonce array.\n"));
@@ -450,7 +450,7 @@
   else
     nn->nmask = 0; /* big jump, unset all bits in the mask */
   nn->nc = nc;
-  MHD_mutex_unlock_ (&daemon->nnc_lock);
+  MHD_mutex_unlock_chk_ (&daemon->nnc_lock);
   return MHD_YES;
 }
 

Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h     2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/internal.h     2016-10-11 15:20:40 UTC (rev 
38104)
@@ -35,7 +35,30 @@
 #include <gnutls/abstract.h>
 #endif
 #endif
+#include "mhd_options.h"
 
+
+#ifdef MHD_PANIC
+/* Override any defined MHD_PANIC macro with proper one */
+#undef MHD_PANIC
+#endif /* MHD_PANIC */
+
+#ifdef HAVE_MESSAGES
+/**
+ * Trigger 'panic' action based on fatal errors.
+ *
+ * @param msg error message (const char *)
+ */
+#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, 
msg); BUILTIN_NOT_REACHED; } while (0)
+#else
+/**
+ * Trigger 'panic' action based on fatal errors.
+ *
+ * @param msg error message (const char *)
+ */
+#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, 
NULL); BUILTIN_NOT_REACHED; } while (0)
+#endif
+
 #include "mhd_threads.h"
 #include "mhd_locks.h"
 #include "mhd_sockets.h"
@@ -82,24 +105,7 @@
 #endif
 
 
-#ifdef HAVE_MESSAGES
 /**
- * Trigger 'panic' action based on fatal errors.
- *
- * @param msg error message (const char *)
- */
-#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, 
msg); BUILTIN_NOT_REACHED; } while (0)
-#else
-/**
- * Trigger 'panic' action based on fatal errors.
- *
- * @param msg error message (const char *)
- */
-#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, 
NULL); BUILTIN_NOT_REACHED; } while (0)
-#endif
-
-
-/**
  * State of the socket with respect to epoll (bitmask).
  */
 enum MHD_EpollState

Modified: libmicrohttpd/src/microhttpd/mhd_itc.h
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_itc.h      2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/mhd_itc.h      2016-10-11 15:20:40 UTC (rev 
38104)
@@ -245,8 +245,8 @@
  * Close emulated pipe FDs
  */
 #define MHD_pipe_close_(pip) do { \
-   MHD_socket_close_ ((pip).fd[0]); \
-   MHD_socket_close_ ((pip).fd[1]); \
+   MHD_socket_close_chk_ ((pip).fd[0]); \
+   MHD_socket_close_chk_ ((pip).fd[1]); \
 } while (0)
 
 /**

Modified: libmicrohttpd/src/microhttpd/mhd_locks.h
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_locks.h    2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/mhd_locks.h    2016-10-11 15:20:40 UTC (rev 
38104)
@@ -54,6 +54,15 @@
 #  error No base mutex API is available.
 #endif
 
+#ifndef MHD_PANIC
+#  include <stdio.h>
+#  include <stdlib.h>
+/* Simple implementation of MHD_PANIC, to be used outside lib */
+#  define MHD_PANIC(msg) do { fprintf (stderr,           \
+     "Abnormal termination at %d line in file %s: %s\n", \
+     (int)__LINE__, __FILE__, msg); abort();} while(0)
+#endif /* ! MHD_PANIC */
+
 #if defined(MHD_PTHREAD_MUTEX_)
   typedef pthread_mutex_t MHD_mutex_;
 #elif defined(MHD_W32_MUTEX_)
@@ -80,20 +89,29 @@
 /**
  * Destroy previously initialised mutex.
  * @param pmutex pointer to mutex
+ * @return nonzero on success, zero otherwise
  */
-#define MHD_mutex_destroy_(pmutex) do { \
-  errno = 0; \
-  if (0 != pthread_mutex_destroy((pmutex))) \
-    MHD_PANIC (_("Failed to destroy mutex\n")); \
-  } while (0)
+#define MHD_mutex_destroy_(pmutex) (!(pthread_mutex_destroy((pmutex))))
 #elif defined(MHD_W32_MUTEX_)
 /**
  * Destroy previously initialised mutex.
  * @param pmutex pointer to mutex
+ * @return Always nonzero
  */
-#define MHD_mutex_destroy_(pmutex) DeleteCriticalSection((pmutex))
+#define MHD_mutex_destroy_(pmutex) (DeleteCriticalSection((pmutex)), !0)
 #endif
 
+/**
+ * Destroy previously initialised mutex and abort execution
+ * if error is detected.
+ * @param pmutex pointer to mutex
+ */
+#define MHD_mutex_destroy_chk_(pmutex) do {       \
+    if (!MHD_mutex_destroy_(pmutex))              \
+      MHD_PANIC(_("Failed to destroy mutex.\n")); \
+  } while(0)
+
+
 #if defined(MHD_PTHREAD_MUTEX_)
 /**
  * Acquire lock on previously initialised mutex.
@@ -100,11 +118,9 @@
  * If mutex was already locked by other thread, function
  * blocks until mutex becomes available.
  * @param pmutex pointer to mutex
+ * @return nonzero on success, zero otherwise
  */
-#define MHD_mutex_lock_(pmutex) do { \
-  if (0 != pthread_mutex_lock((pmutex)))   \
-    MHD_PANIC (_("Failed to lock mutex\n")); \
-  } while (0)
+#define MHD_mutex_lock_(pmutex) (!(pthread_mutex_lock((pmutex))))
 #elif defined(MHD_W32_MUTEX_)
 /**
  * Acquire lock on previously initialised mutex.
@@ -111,10 +127,23 @@
  * If mutex was already locked by other thread, function
  * blocks until mutex becomes available.
  * @param pmutex pointer to mutex
+ * @return Always nonzero
  */
-#define MHD_mutex_lock_(pmutex) EnterCriticalSection((pmutex))
+#define MHD_mutex_lock_(pmutex) (EnterCriticalSection((pmutex)), !0)
 #endif
 
+/**
+ * Acquire lock on previously initialised mutex.
+ * If mutex was already locked by other thread, function
+ * blocks until mutex becomes available.
+ * If error is detected, execution will be aborted.
+ * @param pmutex pointer to mutex
+ */
+#define MHD_mutex_lock_chk_(pmutex) do {       \
+    if (!MHD_mutex_lock_(pmutex))              \
+      MHD_PANIC(_("Failed to lock mutex.\n")); \
+  } while(0)
+
 #if defined(MHD_PTHREAD_MUTEX_)
 /**
  * Unlock previously initialised and locked mutex.
@@ -121,10 +150,7 @@
  * @param pmutex pointer to mutex
  * @return nonzero on success, zero otherwise
  */
-#define MHD_mutex_unlock_(pmutex) do { \
-    if (0 != pthread_mutex_unlock((pmutex)))   \
-    MHD_PANIC (_("Failed to unlock mutex\n")); \
-  } while (0)
+#define MHD_mutex_unlock_(pmutex) (!(pthread_mutex_unlock((pmutex))))
 #elif defined(MHD_W32_MUTEX_)
 /**
  * Unlock previously initialised and locked mutex.
@@ -131,9 +157,18 @@
  * @param pmutex pointer to mutex
  * @return Always nonzero
  */
-#define MHD_mutex_unlock_(pmutex) LeaveCriticalSection((pmutex))
+#define MHD_mutex_unlock_(pmutex) (LeaveCriticalSection((pmutex)), !0)
 #endif
 
+/**
+ * Unlock previously initialised and locked mutex.
+ * If error is detected, execution will be aborted.
+ * @param pmutex pointer to mutex
+ */
+#define MHD_mutex_unlock_chk_(pmutex) do {       \
+    if (!MHD_mutex_unlock_(pmutex))              \
+      MHD_PANIC(_("Failed to unlock mutex.\n")); \
+  } while(0)
 
 /**
  * A semaphore.

Modified: libmicrohttpd/src/microhttpd/mhd_sockets.h
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_sockets.h  2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/mhd_sockets.h  2016-10-11 15:20:40 UTC (rev 
38104)
@@ -117,6 +117,15 @@
 #  define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value()
 #endif /* ! _MHD_FD_SETSIZE_IS_DEFAULT */
 
+#ifndef MHD_PANIC
+#  include <stdio.h>
+#  include <stdlib.h>
+/* Simple implementation of MHD_PANIC, to be used outside lib */
+#  define MHD_PANIC(msg) do { fprintf (stderr,           \
+     "Abnormal termination at %d line in file %s: %s\n", \
+     (int)__LINE__, __FILE__, msg); abort();} while(0)
+#endif /* ! MHD_PANIC */
+
 #ifndef MHD_SOCKET_DEFINED
 /**
  * MHD_socket is type for socket FDs
@@ -195,21 +204,27 @@
  * errno is set to EINTR.  Do not use HP-UNIX.
  *
  * @param fd descriptor to close
+ * @return boolean true on success (error codes like EINTR and EIO are
+ *         counted as success, only EBADF counts as an error!),
+ *         boolean false otherwise.
  */
 #if !defined(MHD_WINSOCK_SOCKETS)
-#  define MHD_socket_close_(fd) do { \
-  if ( (0 != close((fd))) && \
-       (EBADF == errno) ) \
-    MHD_PANIC (_("close failed\n")); \
-  } while (0)
+#  define MHD_socket_close_(fd) ((0 == close((fd))) || (EBADF != errno))
 #else
-#  define MHD_socket_close_(fd) do { \
-  if (0 != closesocket((fd)) ) \
-    MHD_PANIC (_("close failed\n")); \
-  } while (0)
+#  define MHD_socket_close_(fd) (0 == closesocket((fd)))
 #endif
 
 /**
+ * MHD_socket_close_chk_(fd) close socket and abort execution
+ * if error is detected.
+ * @param fd socket to close
+ */
+#define MHD_socket_close_chk_(fd) do {        \
+    if (!MHD_socket_close_(fd))               \
+      MHD_PANIC(_("Close socket failed.\n")); \
+  } while(0)
+
+/**
  * Check whether FD can be added to fd_set with specified FD_SETSIZE.
  * @param fd   the fd to check
  * @param pset the pointer to fd_set to check or NULL to check

Modified: libmicrohttpd/src/microhttpd/response.c
===================================================================
--- libmicrohttpd/src/microhttpd/response.c     2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/microhttpd/response.c     2016-10-11 15:20:40 UTC (rev 
38104)
@@ -568,7 +568,7 @@
     {
       if (NULL == (tmp = malloc (size)))
         {
-          MHD_mutex_destroy_ (&response->mutex);
+          MHD_mutex_destroy_chk_ (&response->mutex);
           free (response);
           return NULL;
         }
@@ -655,7 +655,7 @@
         urh->was_closed = MHD_YES;
         if (MHD_INVALID_SOCKET != urh->app.socket)
           {
-            MHD_socket_close_ (urh->app.socket);
+            MHD_socket_close_chk_ (urh->app.socket);
             urh->app.socket = MHD_INVALID_SOCKET;
           }
         return MHD_YES;
@@ -742,8 +742,8 @@
                   (int) sv[1],
                   (int) FD_SETSIZE);
 #endif
-        MHD_socket_close_ (sv[0]);
-        MHD_socket_close_ (sv[1]);
+        MHD_socket_close_chk_ (sv[0]);
+        MHD_socket_close_chk_ (sv[1]);
         free (urh);
         return MHD_NO;
       }
@@ -814,8 +814,8 @@
                     _("Call to epoll_ctl failed: %s\n"),
                     MHD_socket_last_strerr_ ());
 #endif
-          MHD_socket_close_ (sv[0]);
-          MHD_socket_close_ (sv[1]);
+          MHD_socket_close_chk_ (sv[0]);
+          MHD_socket_close_chk_ (sv[1]);
           free (urh);
           return MHD_NO;
        }
@@ -840,8 +840,8 @@
                     _("Call to epoll_ctl failed: %s\n"),
                     MHD_socket_last_strerr_ ());
 #endif
-          MHD_socket_close_ (sv[0]);
-          MHD_socket_close_ (sv[1]);
+          MHD_socket_close_chk_ (sv[0]);
+          MHD_socket_close_chk_ (sv[1]);
           free (urh);
           return MHD_NO;
        }
@@ -986,14 +986,14 @@
 
   if (NULL == response)
     return;
-  MHD_mutex_lock_ (&response->mutex);
+  MHD_mutex_lock_chk_ (&response->mutex);
   if (0 != --(response->reference_count))
     {
-      MHD_mutex_unlock_ (&response->mutex);
+      MHD_mutex_unlock_chk_ (&response->mutex);
       return;
     }
-  MHD_mutex_unlock_ (&response->mutex);
-  MHD_mutex_destroy_ (&response->mutex);
+  MHD_mutex_unlock_chk_ (&response->mutex);
+  MHD_mutex_destroy_chk_ (&response->mutex);
   if (NULL != response->crfc)
     response->crfc (response->crc_cls);
   while (NULL != response->first_header)
@@ -1016,9 +1016,9 @@
 void
 MHD_increment_response_rc (struct MHD_Response *response)
 {
-  MHD_mutex_lock_ (&response->mutex);
+  MHD_mutex_lock_chk_ (&response->mutex);
   (response->reference_count)++;
-  MHD_mutex_unlock_ (&response->mutex);
+  MHD_mutex_unlock_chk_ (&response->mutex);
 }
 
 

Modified: libmicrohttpd/src/microhttpd/test_shutdown_select.c
===================================================================
--- libmicrohttpd/src/microhttpd/test_shutdown_select.c 2016-10-11 15:12:43 UTC 
(rev 38103)
+++ libmicrohttpd/src/microhttpd/test_shutdown_select.c 2016-10-11 15:20:40 UTC 
(rev 38104)
@@ -90,14 +90,6 @@
 static _MHD_bool check_err;
 
 
-void
-MHD_PANIC (char *msg)
-{
-  fprintf (stderr, "%s", msg);
-  abort ();
-}
-
-
 static _MHD_bool
 has_in_name(const char *prog_name, const char *marker)
 {
@@ -189,7 +181,7 @@
     {
       fprintf (stderr, "Failed to bind socket: %u\n",
                (unsigned)sock_errno);
-      MHD_socket_close_ (fd);
+      MHD_socket_close_chk_ (fd);
       return MHD_INVALID_SOCKET;
     }
 
@@ -198,7 +190,7 @@
     {
       fprintf (stderr, "Failed to make socket non-blocking: %u\n",
                (unsigned)sock_errno);
-      MHD_socket_close_ (fd);
+      MHD_socket_close_chk_ (fd);
       return MHD_INVALID_SOCKET;
     }
 #else  /* MHD_POSIX_SOCKETS */
@@ -209,7 +201,7 @@
     {
       fprintf (stderr, "Failed to make socket non-blocking: %s\n",
               MHD_socket_last_strerr_ ());
-      MHD_socket_close_ (fd);
+      MHD_socket_close_chk_ (fd);
       return MHD_INVALID_SOCKET;
     }
 #endif /* MHD_POSIX_SOCKETS */
@@ -218,7 +210,7 @@
     {
       fprintf (stderr, "Failed to listen on socket: %u\n",
                (unsigned)sock_errno);
-      MHD_socket_close_ (fd);
+      MHD_socket_close_chk_ (fd);
       return MHD_INVALID_SOCKET;
     }
 
@@ -334,7 +326,7 @@
 #if defined(MHD_USE_POSIX_THREADS)
       if (0 != pthread_create (&sel_thrd, NULL, test_func, &listen_socket))
         {
-          MHD_socket_close_ (listen_socket);
+          MHD_socket_close_chk_ (listen_socket);
           fprintf (stderr, "Can't start thread\n");
           return 99;
         }
@@ -342,7 +334,7 @@
       sel_thrd = (HANDLE)_beginthreadex (NULL, 0, test_func, &listen_socket, 
0, NULL);
       if (0 == (sel_thrd))
         {
-          MHD_socket_close_ (listen_socket);
+          MHD_socket_close_chk_ (listen_socket);
           fprintf (stderr, "Can't start select() thread\n");
           return 99;
         }
@@ -359,23 +351,23 @@
       /* fprintf (stdout, "Waiting for thread to finish...\n"); */
       if (!MHD_join_thread_(sel_thrd))
         {
-          MHD_socket_close_(listen_socket);
+          MHD_socket_close_chk_(listen_socket);
           fprintf (stderr, "Can't join select() thread\n");
           return 99;
         }
       if (check_err)
         {
-          MHD_socket_close_(listen_socket);
+          MHD_socket_close_chk_(listen_socket);
           fprintf (stderr, "Error in waiting thread\n");
           return 99;
         }
       end_t = time (NULL);
       /* fprintf (stdout, "Thread finished.\n"); */
-      MHD_socket_close_(listen_socket);
+      MHD_socket_close_chk_(listen_socket);
 
       if (start_t == (time_t)-1 || end_t == (time_t)-1)
         {
-          MHD_socket_close_(listen_socket);
+          MHD_socket_close_chk_(listen_socket);
           fprintf (stderr, "Can't get current time\n");
           return 99;
         }

Modified: libmicrohttpd/src/microhttpd/test_upgrade_common.c
===================================================================
--- libmicrohttpd/src/microhttpd/test_upgrade_common.c  2016-10-11 15:12:43 UTC 
(rev 38103)
+++ libmicrohttpd/src/microhttpd/test_upgrade_common.c  2016-10-11 15:20:40 UTC 
(rev 38104)
@@ -46,14 +46,7 @@
 static int done;
 
 
-void
-MHD_PANIC (char *msg)
-{
-  fprintf (stderr, "%s", msg);
-  abort ();
-}
 
-
 /**
  * Change socket to non-blocking.
  *
@@ -231,7 +224,7 @@
             "World");
   recv_all (*sock,
             "Finished");
-  MHD_socket_close_ (*sock);
+  MHD_socket_close_chk_ (*sock);
   done = 1;
   return NULL;
 }

Modified: libmicrohttpd/src/microhttpd/test_upgrade_ssl.c
===================================================================
--- libmicrohttpd/src/microhttpd/test_upgrade_ssl.c     2016-10-11 15:12:43 UTC 
(rev 38103)
+++ libmicrohttpd/src/microhttpd/test_upgrade_ssl.c     2016-10-11 15:20:40 UTC 
(rev 38104)
@@ -72,15 +72,15 @@
   if (0 != chld)
     {
       *sock = sp[1];
-      MHD_socket_close_ (sp[0]);
+      MHD_socket_close_chk_ (sp[0]);
       return chld;
     }
-  MHD_socket_close_ (sp[1]);
+  MHD_socket_close_chk_ (sp[1]);
   (void) close (0);
   (void) close (1);
   dup2 (sp[0], 0);
   dup2 (sp[0], 1);
-  MHD_socket_close_ (sp[0]);
+  MHD_socket_close_chk_ (sp[0]);
   sprintf (destination,
            "localhost:%u",
            (unsigned int) port);

Modified: libmicrohttpd/src/testcurl/https/test_https_time_out.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_time_out.c      2016-10-11 
15:12:43 UTC (rev 38103)
+++ libmicrohttpd/src/testcurl/https/test_https_time_out.c      2016-10-11 
15:20:40 UTC (rev 38104)
@@ -27,21 +27,11 @@
 
 #include "platform.h"
 #include "microhttpd.h"
-#include "internal.h"
 #include "tls_test_common.h"
 #include <gcrypt.h>
 #include "mhd_sockets.h" /* only macros used */
 
-#undef MHD_PANIC
 
-
-void
-MHD_PANIC (char *msg)
-{
-  fprintf (stderr, "%s", msg);
-  abort ();
-}
-
 #ifdef _WIN32
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1
@@ -80,7 +70,7 @@
   if (ret < 0)
     {
       fprintf (stderr, "Error: %s\n", MHD_E_FAILED_TO_CONNECT);
-      MHD_socket_close_ (sd);
+      MHD_socket_close_chk_ (sd);
       return -1;
     }
 
@@ -88,7 +78,7 @@
   if (ret < 0)
     {
       fprintf (stderr, "Handshake failed\n");
-      MHD_socket_close_ (sd);
+      MHD_socket_close_chk_ (sd);
       return -1;
     }
 
@@ -99,11 +89,11 @@
   if (send (sd, "", 1, 0) == 0)
     {
       fprintf (stderr, "Connection failed to time-out\n");
-      MHD_socket_close_ (sd);
+      MHD_socket_close_chk_ (sd);
       return -1;
     }
 
-  MHD_socket_close_ (sd);
+  MHD_socket_close_chk_ (sd);
   return 0;
 }
 

Modified: libmicrohttpd/src/testcurl/https/test_tls_extensions.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_tls_extensions.c      2016-10-11 
15:12:43 UTC (rev 38103)
+++ libmicrohttpd/src/testcurl/https/test_tls_extensions.c      2016-10-11 
15:20:40 UTC (rev 38104)
@@ -191,7 +191,7 @@
 
 cleanup:
   if (-1 != sd)
-    MHD_socket_close_ (sd);
+    MHD_socket_close_chk_ (sd);
   gnutls_free (cbc.buf);
   return ret;
 }

Modified: libmicrohttpd/src/testcurl/test_get.c
===================================================================
--- libmicrohttpd/src/testcurl/test_get.c       2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/testcurl/test_get.c       2016-10-11 15:20:40 UTC (rev 
38104)
@@ -34,14 +34,7 @@
 #include <time.h>
 #include "mhd_sockets.h" /* only macros used */
 
-void
-MHD_PANIC (char *msg)
-{
-  fprintf (stderr, "%s", msg);
-  abort ();
-}
 
-
 #ifdef _WIN32
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1
@@ -501,7 +494,7 @@
     if (connect (fd, (struct sockaddr *)(&sin), sizeof(sin)) < 0)
     {
        fprintf(stderr, "connect error\n");
-       MHD_socket_close_ (fd);
+       MHD_socket_close_chk_ (fd);
        return 512;
     }
 
@@ -512,7 +505,7 @@
     /* printf("Stopping daemon\n"); */
     MHD_stop_daemon (d);
 
-    MHD_socket_close_ (fd);
+    MHD_socket_close_chk_ (fd);
 
     /* printf("good\n"); */
     return 0;

Modified: libmicrohttpd/src/testcurl/test_quiesce.c
===================================================================
--- libmicrohttpd/src/testcurl/test_quiesce.c   2016-10-11 15:12:43 UTC (rev 
38103)
+++ libmicrohttpd/src/testcurl/test_quiesce.c   2016-10-11 15:20:40 UTC (rev 
38104)
@@ -34,14 +34,7 @@
 #include <pthread.h>
 #include "mhd_sockets.h" /* only macros used */
 
-void
-MHD_PANIC (char *msg)
-{
-  fprintf (stderr, "%s", msg);
-  abort ();
-}
 
-
 #ifndef WINDOWS
 #include <unistd.h>
 #include <sys/socket.h>
@@ -150,7 +143,7 @@
       if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
         {
           MHD_stop_daemon (d);
-          MHD_socket_close_(fd);
+          MHD_socket_close_chk_(fd);
           return "MHD_get_fdset() failed";
         }
       tv.tv_sec = 0;
@@ -293,7 +286,7 @@
       fprintf(stderr, "%s\n", cbc.buf);
       curl_easy_cleanup (c);
       MHD_stop_daemon (d);
-      MHD_socket_close_(fd);
+      MHD_socket_close_chk_(fd);
       return 4;
     }
   if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
@@ -301,7 +294,7 @@
       fprintf(stderr, "%s\n", cbc.buf);
       curl_easy_cleanup (c);
       MHD_stop_daemon (d);
-      MHD_socket_close_(fd);
+      MHD_socket_close_chk_(fd);
       return 8;
     }
 
@@ -313,12 +306,12 @@
       fprintf (stderr, "curl_easy_perform should fail\n");
       curl_easy_cleanup (c);
       MHD_stop_daemon (d);
-      MHD_socket_close_(fd);
+      MHD_socket_close_chk_(fd);
       return 2;
     }
   curl_easy_cleanup (c);
   MHD_stop_daemon (d);
-  MHD_socket_close_(fd);
+  MHD_socket_close_chk_(fd);
 
   return 0;
 }
@@ -478,7 +471,7 @@
       curl_multi_cleanup (multi);
     }
   MHD_stop_daemon (d);
-  MHD_socket_close_ (fd);
+  MHD_socket_close_chk_ (fd);
   if (cbc.pos != strlen ("/hello_world"))
     return 8192;
   if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))




reply via email to

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