Date: Tue, 11 Jun 2024 13:53:40 GMT From: Peter Holm <pho@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: ff4a72c159e0 - main - stress2: Replace random() with arc4random() Message-ID: <202406111353.45BDremQ022470@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=ff4a72c159e06c15a4573b9a4b40f6dc55544538 commit ff4a72c159e06c15a4573b9a4b40f6dc55544538 Author: Peter Holm <pho@FreeBSD.org> AuthorDate: 2024-06-11 13:52:34 +0000 Commit: Peter Holm <pho@FreeBSD.org> CommitDate: 2024-06-11 13:52:34 +0000 stress2: Replace random() with arc4random() --- tools/test/stress2/misc/nfsrename.sh | 4 ++-- tools/test/stress2/misc/umountf2.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/test/stress2/misc/nfsrename.sh b/tools/test/stress2/misc/nfsrename.sh index b6513fba1553..864c64aed8ac 100755 --- a/tools/test/stress2/misc/nfsrename.sh +++ b/tools/test/stress2/misc/nfsrename.sh @@ -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"); @@ -150,7 +150,7 @@ random_sleep(int base, int slop) { long val; - val = random() % slop; + val = arc4random() % slop; usleep(base + val); } diff --git a/tools/test/stress2/misc/umountf2.sh b/tools/test/stress2/misc/umountf2.sh index 5018a804c403..cd5b53616f97 100755 --- a/tools/test/stress2/misc/umountf2.sh +++ b/tools/test/stress2/misc/umountf2.sh @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406111353.45BDremQ022470>