aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-05 16:28:45 (GMT)
committerJouni Malinen <j@w1.fi>2015-09-05 16:28:45 (GMT)
commitc1d43d0bac53d9d8b3eb3f456ed4707ae2c3462c (patch)
tree0f9fd2b0352758887654a2ac2b74963e4adeef17 /src
parent9425bb7828b05caf7b81b4d69ccd690593451746 (diff)
downloadhostap-c1d43d0bac53d9d8b3eb3f456ed4707ae2c3462c.zip
hostap-c1d43d0bac53d9d8b3eb3f456ed4707ae2c3462c.tar.gz
hostap-c1d43d0bac53d9d8b3eb3f456ed4707ae2c3462c.tar.bz2
WPS: Merge identical error paths in ssdp_listener_open()
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r--src/wps/wps_upnp_ssdp.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/wps/wps_upnp_ssdp.c b/src/wps/wps_upnp_ssdp.c
index f04b47c..968fc03 100644
--- a/src/wps/wps_upnp_ssdp.c
+++ b/src/wps/wps_upnp_ssdp.c
@@ -740,11 +740,9 @@ int ssdp_listener_open(void)
int sd;
sd = socket(AF_INET, SOCK_DGRAM, 0);
- if (sd < 0)
- goto fail;
- if (fcntl(sd, F_SETFL, O_NONBLOCK) != 0)
- goto fail;
- if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
+ if (sd < 0 ||
+ fcntl(sd, F_SETFL, O_NONBLOCK) != 0 ||
+ setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
goto fail;
os_memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
@@ -756,9 +754,8 @@ int ssdp_listener_open(void)
mcast_addr.imr_interface.s_addr = htonl(INADDR_ANY);
mcast_addr.imr_multiaddr.s_addr = inet_addr(UPNP_MULTICAST_ADDRESS);
if (setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (char *) &mcast_addr, sizeof(mcast_addr)))
- goto fail;
- if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_TTL,
+ (char *) &mcast_addr, sizeof(mcast_addr)) ||
+ setsockopt(sd, IPPROTO_IP, IP_MULTICAST_TTL,
&ttl, sizeof(ttl)))
goto fail;