aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2019-12-13 04:12:13 +0000
committerConrad Meyer <cem@FreeBSD.org>2019-12-13 04:12:13 +0000
commitd82e4d759d8001dd1912148037ca444aafc7a2cd (patch)
treebb107a360e3c53bd410438eda96c8628feb5ab38
parent6425a52feb6f415427a4e96aba4ec3e7ae91f1d8 (diff)
downloadsrc-d82e4d759d8001dd1912148037ca444aafc7a2cd.tar.gz
src-d82e4d759d8001dd1912148037ca444aafc7a2cd.zip
fsirand(8): Just use arc4random(3)
Remove single use of dubious srandomdev(3) + random(3) and replace with arc4random(3), as is used already in this program. Follow-up question: Do we really need this program anymore? In base?
Notes
Notes: svn path=/head/; revision=355692
-rw-r--r--sbin/fsirand/fsirand.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index f24d34705b72..48ffcbaf0665 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -83,8 +83,6 @@ main(int argc, char *argv[])
if (argc - optind < 1)
usage();
- srandomdev();
-
/* Increase our data size to the max */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
@@ -167,7 +165,7 @@ fsirand(char *device)
if (!printonly) {
/* Randomize fs_id and write out new sblock and backups */
sblock->fs_id[0] = (u_int32_t)time(NULL);
- sblock->fs_id[1] = random();
+ sblock->fs_id[1] = arc4random();
if (sbput(devfd, sblock, sblock->fs_ncg) != 0) {
warn("could not write updated superblock");
return (1);