mirror of
https://github.com/json-c/json-c.git
synced 2026-04-01 19:39:07 +08:00
Use getrandom() if available in json_c_get_random_seed
Lower overhead than opening & reading from /dev/urandom, and works in chroots and other situtations where /dev/urandom is not available. Falls back to existing methods when kernel doesn't support the syscall.
This commit is contained in:
@@ -144,6 +144,7 @@ check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_file(sys/cdefs.h HAVE_SYS_CDEFS_H)
|
||||
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
||||
check_include_file(sys/random.h HAVE_SYS_RANDOM_H)
|
||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_file(xlocale.h HAVE_XLOCALE_H)
|
||||
|
||||
@@ -190,6 +191,9 @@ endif()
|
||||
if (HAVE_SYSLOG_H)
|
||||
check_symbol_exists(vsyslog "syslog.h" HAVE_VSYSLOG)
|
||||
endif()
|
||||
if (HAVE_SYS_RANDOM_H)
|
||||
check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
|
||||
endif()
|
||||
if (HAVE_SYS_RESOURCE_H)
|
||||
check_symbol_exists(getrusage "sys/resource.h" HAVE_GETRUSAGE)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user