Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/net CID 1107543, 230676, 1107543, 976795, 230676, ...
details: https://anonhg.NetBSD.org/src/rev/64b90fab75b0
branches: trunk
changeset: 791337:64b90fab75b0
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 13 21:41:23 2013 +0000
description:
CID 1107543, 230676, 1107543, 976795, 230676, 976795, 1125885, etc.
diffstat:
tests/net/net/t_unix.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diffs (68 lines):
diff -r 299e11e5883b -r 64b90fab75b0 tests/net/net/t_unix.c
--- a/tests/net/net/t_unix.c Wed Nov 13 21:36:57 2013 +0000
+++ b/tests/net/net/t_unix.c Wed Nov 13 21:41:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unix.c,v 1.10 2013/10/20 17:36:36 christos Exp $ */
+/* $NetBSD: t_unix.c,v 1.11 2013/11/13 21:41:23 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.10 2013/10/20 17:36:36 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.11 2013/11/13 21:41:23 christos Exp $");
#else
#define getprogname() argv[0]
#endif
@@ -169,8 +169,10 @@
sun->sun_family = AF_UNIX;
if (bind(srvr, (struct sockaddr *)sun, sl) == -1) {
- if (errno == EINVAL && sl >= 256)
+ if (errno == EINVAL && sl >= 256) {
+ close(srvr);
return -1;
+ }
FAIL("bind");
}
@@ -187,6 +189,7 @@
if (closeit) {
if (close(clnt) == -1)
FAIL("close");
+ clnt = -1;
}
acpt = acc(srvr);
@@ -233,18 +236,23 @@
"sun->sun_path[%zu] %d\n", i,
sock_addr->sun_path[i], i, sun->sun_path[i]);
- (void)close(acpt);
- (void)close(srvr);
- if (!closeit)
+ if (acpt != -1)
+ (void)close(acpt);
+ if (srvr != -1)
+ (void)close(srvr);
+ if (clnt != -1 && !closeit)
(void)close(clnt);
free(sock_addr);
free(sun);
return 0;
fail:
- (void)close(acpt);
- (void)close(srvr);
- (void)close(clnt);
+ if (acpt != -1)
+ (void)close(acpt);
+ if (srvr != -1)
+ (void)close(srvr);
+ if (clnt != -1 && !closeit)
+ (void)close(clnt);
free(sock_addr);
free(sun);
return -1;
Home |
Main Index |
Thread Index |
Old Index