aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-05-03 16:58:40 +0200
committerBrian Behlendorf <[email protected]>2022-05-11 10:33:12 -0700
commit1f5bc12893eefb0e3a247c2266c94a6f7f2b3364 (patch)
tree0a3eb101acfb063feb5386e68e84dddb63d1ae12
parent888914486e26d81c8dbfd7a9d8091c05f9fc98ba (diff)
ztest: O_CLOEXEC ztest_fd_rand
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13411
-rw-r--r--cmd/ztest.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cmd/ztest.c b/cmd/ztest.c
index 1b5459f8e..ca05cf265 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) {