summaryrefslogtreecommitdiff
path: root/regress/lib/libpthread/socket
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-01-02 16:15:33 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-01-02 16:15:33 +0000
commitacd2cb62699f195aed19fd71a8032746058b050e (patch)
tree95a4670dc56a3733a0ade2ffafc45687084a2f83 /regress/lib/libpthread/socket
parent5afe04755bfb973fdd672196974289750b0a63c9 (diff)
Be sure both programs are using the same port.
Diffstat (limited to 'regress/lib/libpthread/socket')
-rw-r--r--regress/lib/libpthread/socket/2/socket2.c6
-rw-r--r--regress/lib/libpthread/socket/2a/socket2a.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/regress/lib/libpthread/socket/2/socket2.c b/regress/lib/libpthread/socket/2/socket2.c
index 70747544a65..7ba7d19df7d 100644
--- a/regress/lib/libpthread/socket/2/socket2.c
+++ b/regress/lib/libpthread/socket/2/socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket2.c,v 1.2 2001/09/20 16:43:16 todd Exp $ */
+/* $OpenBSD: socket2.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
* proven@mit.edu All rights reserved.
@@ -127,10 +127,12 @@ sock_accept(arg)
CHECKr(pthread_mutex_lock(&waiter_mutex));
CHECKr(pthread_create(&wthread, NULL, waiter, NULL));
+ sprintf(buf, "%d", port);
+
CHECKe(pid = fork());
switch(pid) {
case 0:
- execl("socket2a", "socket2a", "fork okay", (char *)NULL);
+ execl("socket2a", "socket2a", "fork okay", buf, (char *)NULL);
DIE(errno, "execl");
default:
break;
diff --git a/regress/lib/libpthread/socket/2a/socket2a.c b/regress/lib/libpthread/socket/2a/socket2a.c
index 96278cd981c..67b8a07c4fb 100644
--- a/regress/lib/libpthread/socket/2a/socket2a.c
+++ b/regress/lib/libpthread/socket/2a/socket2a.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket2a.c,v 1.2 2001/09/20 16:43:16 todd Exp $ */
+/* $OpenBSD: socket2a.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
* proven@mit.edu All rights reserved.
@@ -65,7 +65,7 @@ sock_connect(arg)
int fd;
short port;
- port = 3276;
+ port = atoi(arg);
a_sout.sin_family = AF_INET;
a_sout.sin_port = htons(port);
a_sout.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* loopback */
@@ -101,13 +101,13 @@ main(argc, argv)
{
pthread_t thread;
- if (argv[1] && (!strcmp(argv[1], "fork okay"))) {
+ if (argc == 3 && (!strcmp(argv[1], "fork okay"))) {
sleep(1);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
CHECKr(pthread_create(&thread, NULL, sock_connect,
- (void *)0xdeadbeaf));
+ (void *)argv[2]));
CHECKr(pthread_join(thread, NULL));
SUCCEED;
} else {