Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/net Fix the exceed test.
details: https://anonhg.NetBSD.org/src/rev/f6f526a8a0e1
branches: trunk
changeset: 770099:f6f526a8a0e1
user: christos <christos%NetBSD.org@localhost>
date: Mon Oct 03 14:55:23 2011 +0000
description:
Fix the exceed test.
diffstat:
tests/net/net/t_unix.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r bad0cea92d11 -r f6f526a8a0e1 tests/net/net/t_unix.c
--- a/tests/net/net/t_unix.c Mon Oct 03 14:09:38 2011 +0000
+++ b/tests/net/net/t_unix.c Mon Oct 03 14:55:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unix.c,v 1.4 2011/09/30 19:12:35 christos Exp $ */
+/* $NetBSD: t_unix.c,v 1.5 2011/10/03 14:55:23 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$Id: t_unix.c,v 1.4 2011/09/30 19:12:35 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.5 2011/10/03 14:55:23 christos Exp $");
#include <stdio.h>
#include <err.h>
@@ -84,6 +84,7 @@
struct sockaddr_un *sun;
int s, s2;
size_t slen;
+ socklen_t sl;
slen = len + offsetof(struct sockaddr_un, sun_path) + 1;
@@ -98,11 +99,15 @@
sun->sun_path[len] = '\0';
(void)unlink(sun->sun_path);
- sun->sun_len = SUN_LEN(sun);
+ sl = SUN_LEN(sun);
+ sun->sun_len = sl;
sun->sun_family = AF_UNIX;
- if (bind(s, (struct sockaddr *)sun, sun->sun_len) == -1)
+ if (bind(s, (struct sockaddr *)sun, sl) == -1) {
+ if (errno == EINVAL && sl >= 256)
+ return -1;
FAIL("bind");
+ }
if (listen(s, 5) == -1)
FAIL("listen");
@@ -115,7 +120,7 @@
s2 = socket(AF_UNIX, SOCK_STREAM, 0);
if (s == -1)
FAIL("socket");
- if (connect(s2, (struct sockaddr *)sun, sun->sun_len) == -1)
+ if (connect(s2, (struct sockaddr *)sun, sl) == -1)
FAIL("connect");
break;
default:
Home |
Main Index |
Thread Index |
Old Index