summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/mod_random.yo2
-rw-r--r--Src/Modules/random.c4
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 51a859143..7e181e959 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2024-08-31 Oliver Kiddle <opk@zsh.org>
+ * Clinton Bunch: 53060: Doc/Zsh/mod_random.yo,
+ Src/Modules/random.c: silence build warnings
+
* Clinton Bunch: 53056: Completion/Zsh/Type/_module_math_func,
Doc/Makefile.in, Doc/Zsh/mod_random.yo, Src/Modules/random.c,
Src/Modules/random.mdd, Src/Modules/random_real.c, configure.ac:
diff --git a/Doc/Zsh/mod_random.yo b/Doc/Zsh/mod_random.yo
index d2892bf79..4f5622e61 100644
--- a/Doc/Zsh/mod_random.yo
+++ b/Doc/Zsh/mod_random.yo
@@ -41,7 +41,7 @@ tt(inclusive) is a flag that controls whether the result is ever equal to
tt(upper). By default it is not. If this argument is set to a non-zero value
then it may be.
-This is to facilitate a construct like tt($a[zrand_int($#a)+1]) rather
+This is to facilitate a construct like tt($a[zrand_int+LPAR()$#a+RPAR()+1]) rather
than tt($a[zrand_int+LPAR()$#a-1+RPAR()+1]).
For example, if $#a is 16, you would use tt(zrand_int+LPAR()16RPAR()) which has
16 possible return values 0-15. Because the function can return zero, in order
diff --git a/Src/Modules/random.c b/Src/Modules/random.c
index a153d8f64..88ac9543c 100644
--- a/Src/Modules/random.c
+++ b/Src/Modules/random.c
@@ -62,8 +62,10 @@ ssize_t
getrandom_buffer(void *buf, size_t len)
{
ssize_t ret;
+#ifndef HAVE_ARC4RANDOM_BUF
size_t val = 0;
uint8_t *bufptr = buf;
+#endif
do {
errno = 0;
@@ -81,8 +83,10 @@ getrandom_buffer(void *buf, size_t len)
return -1;
}
}
+#ifndef HAVE_ARC4RANDOM_BUF
bufptr += ret;
val += ret;
+#endif
} while (ret < len);
return ret;
}