commit 29e20dfb656e146c8b2797a8d4b12cf6fa87fc92
parent 6d210e7986375d208a75d3a7c82f799e34358645
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sat, 25 May 2019 16:29:54 +0300
Fixed cast of incompatible function pointer,
Default logger must return 'void', not 'int'
Diffstat:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -218,6 +218,19 @@ MHD_check_global_init_ (void)
}
#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
+
+/**
+ * Default logger function
+ */
+static void
+MHD_default_logger_ (void *cls,
+ const char *fm,
+ va_list ap)
+{
+ vfprintf ((FILE*)cls, fm, ap);
+}
+
+
/**
* Trace up to and return master daemon. If the supplied daemon
* is a master, then return the daemon itself.
@@ -5664,7 +5677,7 @@ MHD_start_daemon_va (unsigned int flags,
daemon->listen_backlog_size = 511; /* should be safe value */
#endif /* !SOMAXCONN */
#ifdef HAVE_MESSAGES
- daemon->custom_error_log = (MHD_LogCallback) &vfprintf;
+ daemon->custom_error_log = &MHD_default_logger_;
daemon->custom_error_log_cls = stderr;
#endif
if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) &&
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
@@ -1422,7 +1422,7 @@ struct MHD_Daemon
* Function for logging error messages (if we
* support error reporting).
*/
- void (*custom_error_log) (void *cls, const char *fmt, va_list va);
+ MHD_LogCallback custom_error_log;
/**
* Closure argument to @e custom_error_log.