summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-04-26 17:09:46 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-04-26 17:09:46 +0000
commit880d31d1bbc0ee82a7bfae2423f27592ca507cff (patch)
treea0dd03ba7605330c1da5a60bbaaff19cad22b7c6
parentb2eac2dedd62224df07148a9e42eae0197902c00 (diff)
downloadskalibs-880d31d1bbc0ee82a7bfae2423f27592ca507cff.tar.xz
Fix getrandom() detection: need to run the test, not only link!
-rwxr-xr-xconfigure2
-rw-r--r--src/sysdeps/trygetrandom.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/configure b/configure
index 1eaccd3..f93b835 100755
--- a/configure
+++ b/configure
@@ -511,7 +511,7 @@ EOF
choose cl futimes FUTIMES 'futimes()'
choose cl arc4random ARC4RANDOM 'arc4random()'
choose cl arc4random_addrandom ARC4RANDOM_ADDRANDOM 'arc4random_addrandom()'
- choose cl getrandom GETRANDOM 'getrandom()'
+ choose clr getrandom GETRANDOM 'getrandom()'
choose cl itimer ITIMER 'setitimer()'
echo '#endif' >> $sysdeps/sysdeps.h
diff --git a/src/sysdeps/trygetrandom.c b/src/sysdeps/trygetrandom.c
index b6cda18..8abe3dd 100644
--- a/src/sysdeps/trygetrandom.c
+++ b/src/sysdeps/trygetrandom.c
@@ -19,5 +19,6 @@ static int getrandom (void *buf, size_t buflen, unsigned int flags)
int main (void)
{
char buf[4] ;
- return getrandom(buf, 4, 0) ;
+ if (getrandom(buf, 4, 0) < 0) return 1 ;
+ return 0 ;
}