> 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                                                 [email protected]
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to