Module Name: src Committed By: christos Date: Fri Jan 13 20:09:48 UTC 2017
Modified Files: src/tests/lib/libc/sys: t_connect.c Log Message: PR/51850: Ngie Cooper: add sys/socket.h for socket(2) and don't leak fds To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_connect.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_connect.c diff -u src/tests/lib/libc/sys/t_connect.c:1.2 src/tests/lib/libc/sys/t_connect.c:1.3 --- src/tests/lib/libc/sys/t_connect.c:1.2 Sun Apr 5 19:17:41 2015 +++ src/tests/lib/libc/sys/t_connect.c Fri Jan 13 15:09:48 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: t_connect.c,v 1.2 2015/04/05 23:17:41 rtr Exp $ */ +/* $NetBSD: t_connect.c,v 1.3 2017/01/13 20:09:48 christos Exp $ */ /* * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/socket.h> #include <err.h> #include <errno.h> #include <string.h> @@ -52,6 +53,9 @@ ATF_TC_BODY(connect_low_port, tc) slist = socket(AF_INET, SOCK_STREAM, 0); sd = socket(AF_INET, SOCK_STREAM, 0); + ATF_REQUIRE(sd > 0); + ATF_REQUIRE(slist > 0); + /* bind listening socket */ memset(&sinlist, 0, sizeof(sinlist)); sinlist.sin_family = AF_INET; @@ -88,6 +92,7 @@ ATF_TC_BODY(connect_low_port, tc) ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX); close(sd); + close(slist); } ATF_TC(connect_foreign_family);