ztest: O_CLOEXEC ztest_fd_rand

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13411
This commit is contained in:
наб 2022-05-03 16:58:40 +02:00 committed by Brian Behlendorf
parent 888914486e
commit 1f5bc12893
1 changed files with 1 additions and 2 deletions

View File

@ -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) {