aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-image.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2016-05-26 10:56:51 +0800
committerDavid Sterba <dsterba@suse.com>2016-06-03 14:49:42 +0200
commit2171228b200bfd1e1c9e993f7cac6567e6c94609 (patch)
tree8ca0feb88597cab357f4f5f3a64bef7ebf2cb389 /btrfs-image.c
parent17239a9c89dec5576784675edd205264535c1557 (diff)
downloadbtrfs-progs-2171228b200bfd1e1c9e993f7cac6567e6c94609.tar.gz
btrfs-progs-2171228b200bfd1e1c9e993f7cac6567e6c94609.tar.xz
btrfs-progs-2171228b200bfd1e1c9e993f7cac6567e6c94609.zip
btrfs-progs: Use new random number API
Replace old and not so informal srand()/rand() calls to new random number API. Including btrfs-corrupt-block(main user), btrfs-image and btrfs-crc. Some tests like dir-test/random-test/quick-test is not modified. As random-test itself can't even pass build. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-image.c')
-rw-r--r--btrfs-image.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 660b0aa..6feeb46 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -195,7 +195,7 @@ static char *generate_garbage(u32 name_len)
return NULL;
for (i = 0; i < name_len; i++) {
- char c = rand() % 94 + 33;
+ char c = rand_range(94) + 33;
if (c == '/')
c++;
@@ -408,7 +408,7 @@ static char *find_collision(struct metadump_struct *md, char *name,
"generating normal garbage, it won't match indexes\n",
val->len, val->val);
for (i = 0; i < name_len; i++) {
- char c = rand() % 94 + 33;
+ char c = rand_range(94) + 33;
if (c == '/')
c++;