listen_low_port: check for errors from socket(2) before continuing

MFC after:	3 days
Reported by:	Coverity
CID:		976778
This commit is contained in:
Enji Cooper 2017-01-04 03:59:50 +00:00
parent 2020383ffd
commit 619898777b

View File

@ -110,6 +110,9 @@ ATF_TC_BODY(listen_low_port, tc)
int sd, val;
sd = socket(AF_INET, SOCK_STREAM, 0);
#ifdef __FreeBSD__
ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
#endif
val = IP_PORTRANGE_LOW;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,