Don't ignore setsockopt return value

PUBLISHED_FROM=f3c1fcf015f6f72eca2eb3d5dad469cd66a837a9
This commit is contained in:
Dmitry Frank 2018-01-30 20:46:20 +02:00 committed by Cesanta Bot
parent bd15ad4301
commit 33f53ab000

View File

@ -3450,8 +3450,11 @@ void mg_socket_if_connect_udp(struct mg_connection *nc) {
}
if (nc->flags & MG_F_ENABLE_BROADCAST) {
int optval = 1;
setsockopt(nc->sock, SOL_SOCKET, SO_BROADCAST, (const char *) &optval,
sizeof(optval));
if (setsockopt(nc->sock, SOL_SOCKET, SO_BROADCAST, (const char *) &optval,
sizeof(optval)) < 0) {
nc->err = mg_get_errno() ? mg_get_errno() : 1;
return;
}
}
nc->err = 0;
}