Commit 32087067 authored by Jean-Paul Saman's avatar Jean-Paul Saman

examples/dvbinfo/udp.c: Check setsockopt return values (CID 17231)

parent 638d76dc
...@@ -264,12 +264,16 @@ int udp_open(const char *interface, const char *ipaddress, int port) ...@@ -264,12 +264,16 @@ int udp_open(const char *interface, const char *ipaddress, int port)
/* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s)
* to avoid packet loss caused in case of scheduling hiccups */ * to avoid packet loss caused in case of scheduling hiccups */
setsockopt (s_ctl, SOL_SOCKET, SO_RCVBUF, if (setsockopt (s_ctl, SOL_SOCKET, SO_RCVBUF,
(void *)&(int){ 0x80000 }, sizeof (int)); (void *)&(int){ 0x80000 }, sizeof (int)) < 0)
setsockopt (s_ctl, SOL_SOCKET, SO_SNDBUF, perror("udp setsockopt error");
(void *)&(int){ 0x80000 }, sizeof (int));
setsockopt (s_ctl, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int)); if (setsockopt (s_ctl, SOL_SOCKET, SO_SNDBUF,
(void *)&(int){ 0x80000 }, sizeof (int)) < 0)
perror("udp setsockopt error");
if (setsockopt (s_ctl, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int)) < 0)
perror("udp setsockopt error");
result = bind(s_ctl, ptr->ai_addr, ptr->ai_addrlen); result = bind(s_ctl, ptr->ai_addr, ptr->ai_addrlen);
if (result < 0) if (result < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment