erofs-utils: fix missing getrandom() on some macOS platforms
Subsystems (2)
PATCH 1/1 erofs-utils: fix missing getrandom() on some macOS platforms
It has <sys/random.h> but not getrandom().
Fixes 5de439566bc5 ("erofs-utils: Provide identical functionality without libuuid")
Signed-off-by Gao Xiang <[email protected]>
--- configure.ac | 1 + lib/uuid.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
configure.ac +1 -0
@@ -266,6 +266,7 @@ AC_CHECK_FUNCS(m4_flatten([ backtrace copy_file_range fallocate + getrandom getrlimit gettimeofday lgetxattr
lib/uuid.c +2 -2
@@ -41,9 +41,9 @@ static int s_getrandom(void *out, unsigned size, bool insecure)ssize_t r;int err; -#ifdef HAVE_SYS_RANDOM_H +#if defined(HAVE_SYS_RANDOM_H ) && defined(HAVE_GETRANDOM ) r =getrandom (out, size, flags); -#elif defined(__NR_getrandom) +#elif defined(__linux__) && defined(__NR_getrandom) r = (ssize_t )syscall (__NR_getrandom, out, size, flags);#else r =-1 ;
Signature · 1 line
2.43.5