summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authord <d@openbsd.org>2000-01-06 06:53:52 +0000
committerd <d@openbsd.org>2000-01-06 06:53:52 +0000
commit1c02c1183dbdf5666ffc8241aa3bf911ae225673 (patch)
treef3925e087d35c291cb8c07246d9aa2df31ee521a /lib
parentcomment (diff)
downloadwireguard-openbsd-1c02c1183dbdf5666ffc8241aa3bf911ae225673.tar.xz
wireguard-openbsd-1c02c1183dbdf5666ffc8241aa3bf911ae225673.zip
cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/TEST/test_fcntl.c11
-rw-r--r--lib/libc_r/TEST/test_pause.c21
2 files changed, 25 insertions, 7 deletions
diff --git a/lib/libc_r/TEST/test_fcntl.c b/lib/libc_r/TEST/test_fcntl.c
index bfe38cb16ec..c501eb8b59c 100644
--- a/lib/libc_r/TEST/test_fcntl.c
+++ b/lib/libc_r/TEST/test_fcntl.c
@@ -1,10 +1,15 @@
+/* $OpenBSD: test_fcntl.c,v 1.3 2000/01/06 06:53:52 d Exp $ */
+/*
+ * Test fcntl() flag inheritance across a fork()
+ */
#include <stdio.h>
#include <fcntl.h>
#include "test.h"
+int
main()
{
- int flags, child;
+ int flags, newflags, child;
CHECKe(flags = fcntl(0, F_GETFL));
printf("flags = %x\n", flags);
@@ -20,8 +25,8 @@ main()
}
while(1){
- CHECKe(flags = fcntl(0, F_GETFL));
- printf ("parent %d flags = %x\n", child, flags);
+ CHECKe(newflags = fcntl(0, F_GETFL));
+ printf ("parent %d flags = %x\n", child, newflags);
sleep(1);
}
}
diff --git a/lib/libc_r/TEST/test_pause.c b/lib/libc_r/TEST/test_pause.c
index ab71982d7d6..be27ac8af50 100644
--- a/lib/libc_r/TEST/test_pause.c
+++ b/lib/libc_r/TEST/test_pause.c
@@ -1,21 +1,34 @@
+/* $OpenBSD: test_pause.c,v 1.3 2000/01/06 06:55:13 d Exp $ */
+/*
+ * Test pause()
+ */
#include <stdio.h>
#include <signal.h>
#include <string.h>
+#include <unistd.h>
#include "test.h"
-foo(int sig)
+int gotsig = 0;
+
+void
+handler(sig)
+ int sig;
{
printf("%s\n", strsignal(sig));
- return;
}
+int
main()
{
sigset_t all;
+ pid_t self;
- CHECKe(signal(1, foo));
- CHECKe(sigfillset(&all));
+ ASSERT(signal(SIGHUP, handler) != SIG_ERR);
+ CHECKe(self = getpid());
+ CHECKe(sigemptyset(&all));
+ CHECKe(sigaddset(&all, SIGHUP));
CHECKe(sigprocmask(SIG_BLOCK, &all, NULL));
+ CHECKe(kill(self, SIGHUP));
CHECKe(pause());
SUCCEED;
}