--- stream.c.orig 2016-10-25 01:39:24 UTC +++ stream.c @@ -577,7 +577,7 @@ Error: "Content-Type: text/html\r\n" "Keep-Alive: timeout=%i\r\n" "Connection: keep-alive\r\n" - "Content-Length: %Zu\r\n\r\n", + "Content-Length: %zu\r\n\r\n", request_auth_response_template, server_nonce, KEEP_ALIVE_TIMEOUT, strlen(auth_failed_html_template)); if (write(p->sock, buffer, strlen(buffer)) < 0) @@ -730,6 +730,7 @@ int http_bindsock(int port, int local, i sin.ss_family = ipv6_enabled?AF_INET6:AF_INET; if (ipv6_enabled) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)&sin; + sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); if(local) { @@ -741,6 +742,7 @@ int http_bindsock(int port, int local, i } } else { struct sockaddr_in *sin4 = (struct sockaddr_in*)&sin; + sin4->sin_len = sizeof(struct sockaddr_in); sin4->sin_family = AF_INET; sin4->sin_port = htons(port); if(local) { @@ -752,14 +754,14 @@ int http_bindsock(int port, int local, i } } - if (bind(sd, (struct sockaddr*)&sin, sizeof(sin)) != 0) { + if (bind(sd, (struct sockaddr*)&sin, sin.ss_len) != 0) { MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, "%s: error binding on %s port %d", addr_str, port); close(sd); return -1; } if (listen(sd, DEF_MAXWEBQUEUE) != 0) { - MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: error listening"); + MOTION_LOG(CRT, TYPE_STREAM, NO_ERRNO, "%s: error listening"); close(sd); return -1; }