aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-05-28 08:55:32 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-05-28 08:55:32 +0000
commit25bd867ef1b8c2fe3c769b21edadc36774452ca4 (patch)
tree27cc5bb379d2bd8e6fe3db78128efbf88e4689e6 /tests
parentfa15d1eafbcf22b4bb326bdf165593745b826d6b (diff)
Notes
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/file/newfileops_on_fork_test.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/sys/file/newfileops_on_fork_test.c b/tests/sys/file/newfileops_on_fork_test.c
index 85eea9dac96f..bdf017172bdc 100644
--- a/tests/sys/file/newfileops_on_fork_test.c
+++ b/tests/sys/file/newfileops_on_fork_test.c
@@ -61,7 +61,7 @@ do_accept(__unused void *arg)
accept_fd = accept(listen_fd, NULL, NULL);
if (accept_fd < 0)
- err(-1, "accept");
+ err(1, "accept");
return (NULL);
}
@@ -73,7 +73,7 @@ do_fork(void)
pid = fork();
if (pid < 0)
- err(-1, "fork");
+ err(1, "fork");
if (pid > 0) {
waitpid(pid, NULL, 0);
exit(0);
@@ -84,15 +84,15 @@ do_fork(void)
* listen_fd+1, and get back EBADF if it's not a valid descriptor,
* and EINVAL if it is. This (currently) works fine in practice.
*/
- if (ftruncate(listen_fd + 1, 0 < 0)) {
+ if (ftruncate(listen_fd + 1, 0) < 0) {
if (errno == EBADF)
exit(0);
else if (errno == EINVAL)
- errx(-1, "file descriptor still open in child");
+ errx(1, "file descriptor still open in child");
else
- err(-1, "unexpected error");
+ err(1, "unexpected error");
} else
- errx(-1, "ftruncate succeeded");
+ errx(1, "ftruncate succeeded");
}
int
@@ -103,18 +103,18 @@ main(__unused int argc, __unused char *argv[])
listen_fd = socket(PF_INET, SOCK_STREAM, 0);
if (listen_fd < 0)
- err(-1, "socket");
+ err(1, "socket");
bzero(&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_len = sizeof(sin);
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
sin.sin_port = htons(PORT);
if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0)
- err(-1, "bind");
+ err(1, "bind");
if (listen(listen_fd, -1) <0)
- err(-1, "listen");
+ err(1, "listen");
if (pthread_create(&accept_thread, NULL, do_accept, NULL) != 0)
- err(-1, "pthread_create");
+ err(1, "pthread_create");
sleep(1); /* Easier than using a CV. */
do_fork();
exit(0);