commit 5c659994bf7fcc8521fe2304dae5f01a5360081a
parent e8ee7c64bd2ecde31014df24141fa0e0b2ad554a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Thu, 24 Dec 2020 15:27:55 +0300
examples: fixed wrong array initialisation
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
@@ -879,6 +879,7 @@ main (int argc, char *const *argv)
{
struct MHD_Daemon *d;
uint16_t port;
+ size_t i;
if (argc != 2)
{
@@ -891,7 +892,8 @@ main (int argc, char *const *argv)
port, NULL, NULL, &ahc_cb, &port, MHD_OPTION_END);
if (NULL == d)
return 1;
- memset (CLIENT_SOCKS, -1, sizeof (CLIENT_SOCKS));
+ for (i = 0; i < sizeof(CLIENT_SOCKS) / sizeof(CLIENT_SOCKS[0]); ++i)
+ CLIENT_SOCKS[i] = MHD_INVALID_SOCKET;
(void) getc (stdin);
MHD_stop_daemon (d);
return 0;