summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-17 18:20:33 +0000
committerpfg <pfg@FreeBSD.org>2016-05-17 18:20:33 +0000
commitb197fd3c5b861a6e7e33179a60d8462660b8a13f (patch)
tree772e061f693e114f42f4c8feca14787d8bbb0f86 /usr.sbin
parent627859d86b490f27f74bc9a9e164dd52ef984e47 (diff)
downloadFreeBSD-src-b197fd3c5b861a6e7e33179a60d8462660b8a13f.zip
FreeBSD-src-b197fd3c5b861a6e7e33179a60d8462660b8a13f.tar.gz
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
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/makefs/ffs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index dd97c01..fba5422 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1125,9 +1125,10 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
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,
OpenPOWER on IntegriCloud