summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-07-06 11:50:35 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-07-06 11:50:35 +0000
commit4a491f62e7da10016cab00c0033dbf592b978efb (patch)
tree0263cc595baf49c112a014785d3be7e569b3e018 /regress/usr.bin
parent0d2a787f98dcdd59b3bb55f6f0b1581207b2ea11 (diff)
alarm(3) cannot fail, remove error handling.
suggested by millert@
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/nc/client-tcp.c4
-rw-r--r--regress/usr.bin/nc/server-tcp.c6
-rw-r--r--regress/usr.bin/nc/util.c10
-rw-r--r--regress/usr.bin/nc/util.h3
4 files changed, 7 insertions, 16 deletions
diff --git a/regress/usr.bin/nc/client-tcp.c b/regress/usr.bin/nc/client-tcp.c
index b26c3f3695f..738ddcb441e 100644
--- a/regress/usr.bin/nc/client-tcp.c
+++ b/regress/usr.bin/nc/client-tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client-tcp.c,v 1.2 2020/01/17 20:45:50 bluhm Exp $ */
+/* $OpenBSD: client-tcp.c,v 1.3 2021/07/06 11:50:34 bluhm Exp $ */
/*
* Copyright (c) 2020 Alexander Bluhm <bluhm@openbsd.org>
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
usage();
}
- alarm_timeout();
+ alarm(10);
s = connect_socket(host, port);
print_sockname(s);
print_peername(s);
diff --git a/regress/usr.bin/nc/server-tcp.c b/regress/usr.bin/nc/server-tcp.c
index 40d0f250e1e..2dec72f44bb 100644
--- a/regress/usr.bin/nc/server-tcp.c
+++ b/regress/usr.bin/nc/server-tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-tcp.c,v 1.3 2020/01/21 22:47:39 bluhm Exp $ */
+/* $OpenBSD: server-tcp.c,v 1.4 2021/07/06 11:50:34 bluhm Exp $ */
/*
* Copyright (c) 2020 Alexander Bluhm <bluhm@openbsd.org>
@@ -77,7 +77,7 @@ main(int argc, char *argv[])
usage();
}
- alarm_timeout();
+ alarm(10);
s = listen_socket(host, port);
print_sockname(s);
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
err(1, "fork");
case 0:
/* child continues, set timer for new process */
- alarm_timeout();
+ alarm(10);
break;
default:
/* parent exits and test runs in parallel */
diff --git a/regress/usr.bin/nc/util.c b/regress/usr.bin/nc/util.c
index 46c8bfe1520..3aca3b13a0c 100644
--- a/regress/usr.bin/nc/util.c
+++ b/regress/usr.bin/nc/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.2 2020/01/17 20:45:50 bluhm Exp $ */
+/* $OpenBSD: util.c,v 1.3 2021/07/06 11:50:34 bluhm Exp $ */
/*
* Copyright (c) 2020 Alexander Bluhm <bluhm@openbsd.org>
@@ -76,14 +76,6 @@ task_run(int s, struct task *todolist, size_t tlen)
}
void
-alarm_timeout(void)
-{
- /* just abort after 10 seconds */
- if ((int)alarm(10) == -1)
- err(1, "alarm");
-}
-
-void
print_sockname(int s)
{
struct sockaddr_storage ss;
diff --git a/regress/usr.bin/nc/util.h b/regress/usr.bin/nc/util.h
index 71765a486ea..f356fd04c7f 100644
--- a/regress/usr.bin/nc/util.h
+++ b/regress/usr.bin/nc/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.2 2020/01/17 20:45:50 bluhm Exp $ */
+/* $OpenBSD: util.h,v 1.3 2021/07/06 11:50:34 bluhm Exp $ */
/*
* Copyright (c) 2020 Alexander Bluhm <bluhm@openbsd.org>
@@ -23,7 +23,6 @@ struct task {
void task_enqueue(struct task *, int, const char *);
void task_run(int, struct task *, size_t);
-void alarm_timeout(void);
void print_sockname(int);
void print_peername(int);
void receive_eof(int);