Date: Sun, 15 Dec 2019 11:44:45 -0800 (PST) From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> To: Conrad Meyer <cem@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355692 - head/sbin/fsirand Message-ID: <201912151944.xBFJijrq090591@gndrsh.dnsmgr.net> In-Reply-To: <201912130412.xBD4CDZm017850@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Author: cem > Date: Fri Dec 13 04:12:13 2019 > New Revision: 355692 > URL: https://svnweb.freebsd.org/changeset/base/355692 > > Log: > 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? The proper place to ask that is on -arch, not a commit message. > Modified: > head/sbin/fsirand/fsirand.c > > Modified: head/sbin/fsirand/fsirand.c > ============================================================================== > --- head/sbin/fsirand/fsirand.c Fri Dec 13 04:03:05 2019 (r355691) > +++ head/sbin/fsirand/fsirand.c Fri Dec 13 04:12:13 2019 (r355692) > @@ -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); > -- Rod Grimes rgrimes@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912151944.xBFJijrq090591>