Module Name: src
Committed By: christos
Date: Thu Oct 10 16:01:55 UTC 2013
Modified Files:
src/tests/net/net: t_unix.c
Log Message:
make this work on linux
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/net/t_unix.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/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.7 src/tests/net/net/t_unix.c:1.8
--- src/tests/net/net/t_unix.c:1.7 Tue Oct 8 14:05:31 2013
+++ src/tests/net/net/t_unix.c Thu Oct 10 12:01:55 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unix.c,v 1.7 2013/10/08 18:05:31 christos Exp $ */
+/* $NetBSD: t_unix.c,v 1.8 2013/10/10 16:01:55 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,8 +37,17 @@
*/
#include <sys/cdefs.h>
-__RCSID("$Id: t_unix.c,v 1.7 2013/10/08 18:05:31 christos Exp $");
+#ifdef __RCSID
+__RCSID("$Id: t_unix.c,v 1.8 2013/10/10 16:01:55 christos Exp $");
+#else
+#define getprogname() argv[0]
+#endif
+#ifdef __linux__
+#define LX -1
+#else
+#define LX
+#endif
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -144,7 +153,9 @@ test(bool closeit, size_t len)
(void)unlink(sun->sun_path);
sl = SUN_LEN(sun);
+#ifdef BSD4_4
sun->sun_len = sl;
+#endif
sun->sun_family = AF_UNIX;
if (bind(srvr, (struct sockaddr *)sun, sl) == -1) {
@@ -199,7 +210,7 @@ test(bool closeit, size_t len)
sock_addr->sun_family);
len += OF;
- if (sock_addrlen != len)
+ if (sock_addrlen LX != len)
FAIL("sock_addr_len %zu != %zu", (size_t)sock_addrlen, len);
#ifdef BSD4_4
if (sock_addr->sun_len != sl)
@@ -284,6 +295,7 @@ main(int argc, char *argv[])
fprintf(stderr, "Usage: %s <len>\n", getprogname());
return EXIT_FAILURE;
}
- test(atoi(argv[1]));
+ test(false, atoi(argv[1]));
+ test(true, atoi(argv[1]));
}
#endif