aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-05-06 22:36:33 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-05-06 22:36:33 -0400
commita90c62e4359be9b334772ab9c1869cac94d9b2c7 (patch)
tree239458a17c833bfdb2dc91f8568d8026746a0a47
parentaaa68bd1d48087e6e180bbe6563c5aa280ae5e34 (diff)
Check getrandom return value
-rw-r--r--src/stdlib/random.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdlib/random.h b/src/stdlib/random.h
index 861fab56..7311d695 100644
--- a/src/stdlib/random.h
+++ b/src/stdlib/random.h
@@ -17,7 +17,7 @@ static int64_t random_range(int64_t low, int64_t high) {
uint64_t min_r = -range % range;
uint64_t r;
do {
- getrandom(&r, sizeof(r), 0);
+ assert(getrandom(&r, sizeof(r), 0) == sizeof(r));
} while (r < min_r);
return (int64_t)((uint64_t)low + (r % range));
}