|  | @@ -1519,7 +1519,7 @@ int mg_printf(struct mg_connection *conn, const char *fmt, ...) {
 | 
											
												
													
														|  |      // vsnprintf() error, give up
 |  |      // vsnprintf() error, give up
 | 
											
												
													
														|  |      len = -1;
 |  |      len = -1;
 | 
											
												
													
														|  |      cry(conn, "%s(%s, ...): vsnprintf() error", __func__, fmt);
 |  |      cry(conn, "%s(%s, ...): vsnprintf() error", __func__, fmt);
 | 
											
												
													
														|  | -  } else if (len > (int) sizeof(mem) && (buf = malloc(len + 1)) != NULL) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +  } else if (len > (int) sizeof(mem) && (buf = (char *) malloc(len + 1)) != NULL) {
 | 
											
												
													
														|  |      // Local buffer is not large enough, allocate big buffer on heap
 |  |      // Local buffer is not large enough, allocate big buffer on heap
 | 
											
												
													
														|  |      va_start(ap, fmt);
 |  |      va_start(ap, fmt);
 | 
											
												
													
														|  |      vsnprintf(buf, len + 1, fmt, ap);
 |  |      vsnprintf(buf, len + 1, fmt, ap);
 | 
											
										
											
												
													
														|  | @@ -3887,7 +3887,7 @@ static int set_ports_option(struct mg_context *ctx) {
 | 
											
												
													
														|  |                 // handshake will figure out that the client is down and
 |  |                 // handshake will figure out that the client is down and
 | 
											
												
													
														|  |                 // will close the server end.
 |  |                 // will close the server end.
 | 
											
												
													
														|  |                 // Thanks to Igor Klopov who suggested the patch.
 |  |                 // Thanks to Igor Klopov who suggested the patch.
 | 
											
												
													
														|  | -               setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *) &on,
 |  | 
 | 
											
												
													
														|  | 
 |  | +               setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &on,
 | 
											
												
													
														|  |                            sizeof(on)) != 0 ||
 |  |                            sizeof(on)) != 0 ||
 | 
											
												
													
														|  |                 bind(sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
 |  |                 bind(sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
 | 
											
												
													
														|  |                 listen(sock, SOMAXCONN) != 0) {
 |  |                 listen(sock, SOMAXCONN) != 0) {
 | 
											
										
											
												
													
														|  | @@ -4199,7 +4199,7 @@ static void close_socket_gracefully(struct mg_connection *conn) {
 | 
											
												
													
														|  |    // ephemeral port exhaust problem under high QPS.
 |  |    // ephemeral port exhaust problem under high QPS.
 | 
											
												
													
														|  |    linger.l_onoff = 1;
 |  |    linger.l_onoff = 1;
 | 
											
												
													
														|  |    linger.l_linger = 1;
 |  |    linger.l_linger = 1;
 | 
											
												
													
														|  | -  setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger));
 |  | 
 | 
											
												
													
														|  | 
 |  | +  setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *) &linger, sizeof(linger));
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    // Send FIN to the client
 |  |    // Send FIN to the client
 | 
											
												
													
														|  |    (void) shutdown(sock, SHUT_WR);
 |  |    (void) shutdown(sock, SHUT_WR);
 |