libmicrohttpd

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

commit ca1942843f7f8c2904eb4321a69568a6ae45b6e8
parent 61876d057853557018e73cf4bde84d8021d11fbe
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 18 Jan 2015 19:12:14 +0000

fix infinite loop reported by Dominic Froud

Diffstat:
MChangeLog | 4++++
Msrc/include/microhttpd.h | 4++--
Msrc/microhttpd/daemon.c | 3+--
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jan 18 20:09:06 CET 2015 + Fix potential infinite loop on shutdown in multi-threaded mode + under certain conditions. -CG + Mon Dec 22 16:33:18 CET 2014 Releasing 0.9.39. -CG diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -130,7 +130,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00093900 +#define MHD_VERSION 0x00093901 /** * MHD-internal return code for "YES". @@ -170,7 +170,7 @@ typedef intptr_t ssize_t; #define _MHD_EXTERN extern #elif defined (_WIN32) && defined(MHD_W32DLL) /* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */ -#define _MHD_EXTERN __declspec(dllimport) +#define _MHD_EXTERN __declspec(dllimport) #else #define _MHD_EXTERN extern #endif diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -4154,7 +4154,7 @@ close_all_connections (struct MHD_Daemon *daemon) /* now, collect threads from thread pool */ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { - while (NULL != (pos = daemon->connections_head)) + for (pos = daemon->connections_head; NULL != pos; pos = pos->next) { if (0 != MHD_join_thread_ (pos->pid)) MHD_PANIC ("Failed to join a thread\n"); @@ -4633,4 +4633,3 @@ void MHD_fini(void) _SET_INIT_AND_DEINIT_FUNCS(MHD_init, MHD_fini); /* end of daemon.c */ -