aboutsummaryrefslogtreecommitdiff
path: root/tests/sys
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-04-13 17:55:31 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-04-13 17:55:31 +0000
commit605c4cda2f5c274f0b9fc874d254d62944a93a37 (patch)
treed3a11aa6955d38cff97414b2556b5f533503178f /tests/sys
parent7c5e60c72e4fbdc4b3849690acf9728b328def62 (diff)
Notes
Diffstat (limited to 'tests/sys')
-rw-r--r--tests/sys/file/closefrom_test.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/sys/file/closefrom_test.c b/tests/sys/file/closefrom_test.c
index 7ce93415519e7..8516f7f2598c7 100644
--- a/tests/sys/file/closefrom_test.c
+++ b/tests/sys/file/closefrom_test.c
@@ -146,7 +146,7 @@ main(void)
pid_t pid;
int fd, i, start;
- printf("1..19\n");
+ printf("1..20\n");
/* We better start up with fd's 0, 1, and 2 open. */
start = devnull();
@@ -309,5 +309,21 @@ main(void)
fail("close_range", "highest fd %d", fd);
ok("close_range");
+ /* Fork a child process to test closefrom(0) twice. */
+ pid = fork();
+ if (pid < 0)
+ fail_err("fork");
+ if (pid == 0) {
+ /* Child. */
+ closefrom(0);
+ closefrom(0);
+ cok(info, "closefrom(0)");
+ }
+ if (wait(NULL) < 0)
+ fail_err("wait");
+ if (info->failed)
+ fail(info->tag, "%s", info->message);
+ ok(info->tag);
+
return (0);
}