svn commit: r311242 - head/contrib/netbsd-tests/lib/libc/sys

Ngie Cooper ngie at FreeBSD.org
Wed Jan 4 03:59:51 UTC 2017


Author: ngie
Date: Wed Jan  4 03:59:50 2017
New Revision: 311242
URL: https://svnweb.freebsd.org/changeset/base/311242

Log:
  listen_low_port: check for errors from socket(2) before continuing
  
  MFC after:	3 days
  Reported by:	Coverity
  CID:		976778

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_listen.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_listen.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_listen.c	Wed Jan  4 03:57:18 2017	(r311241)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_listen.c	Wed Jan  4 03:59:50 2017	(r311242)
@@ -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,


More information about the svn-src-all mailing list