From 1f5bc12893eefb0e3a247c2266c94a6f7f2b3364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 16:58:40 +0200 Subject: [PATCH] ztest: O_CLOEXEC ztest_fd_rand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #13411 --- cmd/ztest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 1b5459f8e4..ca05cf2651 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -7866,7 +7866,6 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp) if (pid == 0) { /* child */ char fd_data_str[12]; - (void) close(ztest_fd_rand); VERIFY3S(11, >=, snprintf(fd_data_str, 12, "%d", ztest_fd_data)); VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1)); @@ -8013,7 +8012,7 @@ main(int argc, char **argv) * ztest from needlessly depleting the system entropy pool. */ random_path = "/dev/urandom"; - ztest_fd_rand = open(random_path, O_RDONLY); + ztest_fd_rand = open(random_path, O_RDONLY | O_CLOEXEC); ASSERT3S(ztest_fd_rand, >=, 0); if (!fd_data_str) {