Date: Tue, 17 May 2016 18:20:33 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300069 - head/usr.sbin/makefs Message-ID: <201605171820.u4HIKX4N034712@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Tue May 17 18:20:33 2016 New Revision: 300069 URL: https://svnweb.freebsd.org/changeset/base/300069 Log: makefs(1): use all the random(3) range. The generation number is uint32_t so we can fit the complete range of random(3). We could have used arc4random() but the result would be unpredictable and it would prohibit reproducible builds. While here add a comment where seeding is done: this affects reproducible builds and might have to be re-visited to use a release dependent value. MFC after: 2 weeks Modified: head/usr.sbin/makefs/ffs.c Modified: head/usr.sbin/makefs/ffs.c ============================================================================== --- head/usr.sbin/makefs/ffs.c Tue May 17 17:46:12 2016 (r300068) +++ head/usr.sbin/makefs/ffs.c Tue May 17 18:20:33 2016 (r300069) @@ -1125,9 +1125,10 @@ ffs_write_inode(union dinode *dp, uint32 initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) { memset(buf, 0, fs->fs_bsize); dip = (struct ufs2_dinode *)buf; + /* Seeding affects reproducible builds. */ srandom(time(NULL)); for (i = 0; i < INOPB(fs); i++) { - dip->di_gen = random() / 2 + 1; + dip->di_gen = random(); dip++; } ffs_wtfs(fsbtodb(fs, ino_to_fsba(fs,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605171820.u4HIKX4N034712>