summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-01-12 09:36:26 -0800
committerGitHub <[email protected]>2018-01-12 09:36:26 -0800
commite1a0850c3570ae53df5779bc656f17b98b86f160 (patch)
treed17b3ab882718b22d049cd07e7581eda2f76af7a /cmd
parent6df9f8ebd73c05da627144bcc3823e6fe980cd75 (diff)
Force ztest to always use /dev/urandom
For ztest, which is solely for testing, using a pseudo random is entirely reasonable. Using /dev/urandom ensures the system entropy pool doesn't get depleted thus stalling the testing. This is a particular problem when testing in VMs. Reviewed-by: Tim Chase <[email protected]> Reviewed by: Thomas Caputi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #7017 Closes #7036
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ztest/ztest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 89ef1c415..f07e11c83 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -7064,7 +7064,12 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- ztest_fd_rand = open("/dev/urandom", O_RDONLY);
+ /*
+ * Force random_get_bytes() to use /dev/urandom in order to prevent
+ * ztest from needlessly depleting the system entropy pool.
+ */
+ random_path = "/dev/urandom";
+ ztest_fd_rand = open(random_path, O_RDONLY);
ASSERT3S(ztest_fd_rand, >=, 0);
if (!fd_data_str) {