Module Name:    src
Committed By:   christos
Date:           Fri Jan 13 20:41:50 UTC 2017

Modified Files:
        src/tests/lib/libc/sys: t_listen.c

Log Message:
PR/51854: Ngie Cooper: sys/socket.h include and check result from socket(2)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_listen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/t_listen.c
diff -u src/tests/lib/libc/sys/t_listen.c:1.4 src/tests/lib/libc/sys/t_listen.c:1.5
--- src/tests/lib/libc/sys/t_listen.c:1.4	Sun Mar 18 03:00:52 2012
+++ src/tests/lib/libc/sys/t_listen.c	Fri Jan 13 15:41:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_listen.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $	*/
+/*	$NetBSD: t_listen.c,v 1.5 2017/01/13 20:41:50 christos Exp $	*/
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -26,6 +26,7 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/socket.h>
 #include <atf-c.h>
 #include <err.h>
 #include <errno.h>
@@ -106,6 +107,7 @@ ATF_TC_BODY(listen_low_port, tc)
 	int sd, val;
 
 	sd = socket(AF_INET, SOCK_STREAM, 0);
+	ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
 
 	val = IP_PORTRANGE_LOW;
 	if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,

Reply via email to