Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2013 05:39:22 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r249500 - head/sbin/growfs
Message-ID:  <201304150539.r3F5dMgk087724@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Apr 15 05:39:21 2013
New Revision: 249500
URL: http://svnweb.freebsd.org/changeset/base/249500

Log:
  Use arc4random() instead of random().
  
  MFC after:	2 weeks

Modified:
  head/sbin/growfs/growfs.c

Modified: head/sbin/growfs/growfs.c
==============================================================================
--- head/sbin/growfs/growfs.c	Mon Apr 15 05:31:59 2013	(r249499)
+++ head/sbin/growfs/growfs.c	Mon Apr 15 05:39:21 2013	(r249500)
@@ -141,14 +141,9 @@ growfs(int fsi, int fso, unsigned int Nf
 	uint cylno;
 	int i, j, width;
 	char tmpbuf[100];
-	static int randinit = 0;
 
 	DBG_ENTER;
 
-	if (!randinit) {
-		randinit = 1;
-		srandomdev();
-	}
 	time(&modtime);
 
 	/*
@@ -407,7 +402,7 @@ initcg(int cylno, time_t modtime, int fs
 		    i += sblock.fs_frag) {
 			dp1 = (struct ufs1_dinode *)(void *)iobuf;
 			for (j = 0; j < INOPB(&sblock); j++) {
-				dp1->di_gen = random();
+				dp1->di_gen = arc4random();
 				dp1++;
 			}
 			wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304150539.r3F5dMgk087724>