Commit 5c176748 authored by David Gibson's avatar David Gibson

net: Add check for failure of setsockopt()

make_listen_fd() didn't check for failure of setsockopt().  There's no
real reason not to, since we have an obvious way to report an error to the
caller.

Found with Coverity Scan.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 6251b771
...@@ -238,7 +238,9 @@ static int make_listen_fd(const struct addrinfo *addrinfo) ...@@ -238,7 +238,9 @@ static int make_listen_fd(const struct addrinfo *addrinfo)
if (fd < 0) if (fd < 0)
return -1; return -1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0)
goto fail;
if (bind(fd, addrinfo->ai_addr, addrinfo->ai_addrlen) != 0) if (bind(fd, addrinfo->ai_addr, addrinfo->ai_addrlen) != 0)
goto fail; goto fail;
......
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