summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs/ffs/ffs_alloc.c')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index f285b4dab63..928f024a095 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.44 2003/06/02 23:28:22 millert Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.45 2003/10/17 15:08:11 mpech Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -624,7 +624,7 @@ ffs_inode_alloc(struct inode *pip, int mode, struct ucred *cred,
* Need a way to preserve randomization.
*/
if (ip->i_ffs_gen == 0 || ++(ip->i_ffs_gen) == 0)
- ip->i_ffs_gen = arc4random();
+ ip->i_ffs_gen = arc4random() & INT_MAX;
if (ip->i_ffs_gen == 0 || ip->i_ffs_gen == -1)
ip->i_ffs_gen = 1; /* shouldn't happen */
return (0);
@@ -669,7 +669,7 @@ ffs_dirpref(pip)
* Force allocation in another cg if creating a first level dir.
*/
if (ITOV(pip)->v_flag & VROOT) {
- prefcg = arc4random() % fs->fs_ncg;
+ prefcg = (arc4random() & INT_MAX) % fs->fs_ncg;
mincg = prefcg;
minndir = fs->fs_ipg;
for (cg = prefcg; cg < fs->fs_ncg; cg++)