Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys PR/51850: Ngie Cooper: add sys/socket.h f...
details: https://anonhg.NetBSD.org/src/rev/243f6f7679e0
branches: trunk
changeset: 350555:243f6f7679e0
user: christos <christos%NetBSD.org@localhost>
date: Fri Jan 13 20:09:48 2017 +0000
description:
PR/51850: Ngie Cooper: add sys/socket.h for socket(2) and don't leak fds
diffstat:
tests/lib/libc/sys/t_connect.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (35 lines):
diff -r e58f5f9ea688 -r 243f6f7679e0 tests/lib/libc/sys/t_connect.c
--- a/tests/lib/libc/sys/t_connect.c Fri Jan 13 20:08:38 2017 +0000
+++ b/tests/lib/libc/sys/t_connect.c Fri Jan 13 20:09:48 2017 +0000
@@ -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 @@
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_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX);
close(sd);
+ close(slist);
}
ATF_TC(connect_foreign_family);
Home |
Main Index |
Thread Index |
Old Index