Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 03:59:50 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311242 - head/contrib/netbsd-tests/lib/libc/sys
Message-ID:  <201701040359.v043xodu068363@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701040359.v043xodu068363>