Skip to content

Commit

Permalink
stress2: Replace rename() with arc4random()
Browse files Browse the repository at this point in the history
  • Loading branch information
phoatfreebsd committed Jun 11, 2024
1 parent e754909 commit f65d0b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/test/stress2/misc/nfsrename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ write_file(void)
unlink(path);
}

fprintf(fp, "blah blah blah garbage %ld\n", random());
fprintf(fp, "blah blah blah garbage %ld\n", (long)arc4random());
fclose(fp);
if (rename(path, filename) < 0) {
warn("rename");
Expand All @@ -150,7 +150,7 @@ random_sleep(int base, int slop)
{
long val;

val = random() % slop;
val = arc4random() % slop;
usleep(base + val);
}

Expand Down
3 changes: 2 additions & 1 deletion tools/test/stress2/misc/umountf2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -886,11 +886,12 @@ test(void)
{
unsigned long offset;
unsigned long size = maxoplen;
unsigned long rv = random();
unsigned long rv;
unsigned long op = rv % (3 + !lite + mapped_writes);
/* turn off the map read if necessary */
arc4random_buf(&rv, sizeof(rv));
if (op == 2 && !mapped_reads)
op = 0;
Expand Down

0 comments on commit f65d0b1

Please sign in to comment.