summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-30 17:33:46 +0200
committerBruno Haible <bruno@clisp.org>2020-05-30 17:33:46 +0200
commit67ae31b60bedc0a3f1ff4c06177054685b9dcc95 (patch)
tree40fe17f688df693195460133b8ea0968c8b81f21 /tests
parent9e7d098310117f0b17e7868124652a392b0a9854 (diff)
downloadgnulib-67ae31b60bedc0a3f1ff4c06177054685b9dcc95.tar.gz
getrandom: Override incompatible system function on Solaris 11.
* lib/sys_random.in.h (getrandom): Override if REPLACE_GETRANDOM is 1. * lib/getrandom.c (getrandom): When the system has getrandom, just invoke it. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set REPLACE_GETRANDOM if the system's getrandom function's prototype is not the expected one. * m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Initialize REPLACE_GETRANDOM. * modules/sys_random (Makefile.am): Substitute REPLACE_GETRANDOM. * modules/getrandom (modules/getrandom): Consider REPLACE_GETRANDOM. * tests/test-getrandom.c (main): Allow error EINVAL as an alternative to EAGAIN. * doc/glibc-functions/getrandom.texi: Mention the new module and the Solaris problem.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-getrandom.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test-getrandom.c b/tests/test-getrandom.c
index 3c84f871ef..8b25958665 100644
--- a/tests/test-getrandom.c
+++ b/tests/test-getrandom.c
@@ -75,7 +75,8 @@ main (void)
ret = getrandom (large_buf, sizeof (large_buf), GRND_RANDOM | GRND_NONBLOCK);
/* It is very unlikely that so many truly random bytes were ready. */
if (ret < 0)
- ASSERT (errno == ENOSYS || errno == EAGAIN);
+ ASSERT (errno == ENOSYS || errno == EAGAIN
+ || errno == EINVAL /* Solaris */);
else
ASSERT (ret > 0 && ret < sizeof (large_buf));