Commit 4ff814f2 authored by Luca Boccassi's avatar Luca Boccassi

Problem: getrandom test does not check if it's working

Solution: check return value in autoconf and CMake. On some platforms
the function is available but not implemented (eg: GNU/Hurd).
parent 7aba6821
...@@ -883,7 +883,8 @@ AC_DEFUN([LIBZMQ_CHECK_GETRANDOM], [{ ...@@ -883,7 +883,8 @@ AC_DEFUN([LIBZMQ_CHECK_GETRANDOM], [{
int main (int argc, char *argv []) int main (int argc, char *argv [])
{ {
char buf[4]; char buf[4];
getrandom(buf, 4, 0); int rc = getrandom(buf, 4, 0);
return rc == -1 ? 1 : 0;
} }
], ],
[libzmq_cv_getrandom="yes"], [libzmq_cv_getrandom="yes"],
......
...@@ -287,7 +287,8 @@ macro(zmq_check_getrandom) ...@@ -287,7 +287,8 @@ macro(zmq_check_getrandom)
int main (int argc, char *argv []) int main (int argc, char *argv [])
{ {
char buf[4]; char buf[4];
getrandom(buf, 4, 0); int rc = getrandom(buf, 4, 0);
return rc == -1 ? 1 : 0;
} }
" "
ZMQ_HAVE_GETRANDOM) ZMQ_HAVE_GETRANDOM)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment