Skip to content

Instantly share code, notes, and snippets.

@coldnebo
Created May 3, 2017 15:32
Show Gist options
  • Save coldnebo/98d6166feb4c16220afe451a012c98a0 to your computer and use it in GitHub Desktop.
Save coldnebo/98d6166feb4c16220afe451a012c98a0 to your computer and use it in GitHub Desktop.
fix for compile issue encountered in https://github.com/rvm/rvm/issues/4000
diff --git a/random.c b/random.c
index e669e98..9334921 100644
--- a/random.c
+++ b/random.c
@@ -521,7 +521,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int unused)
CryptGenRandom(prov, size, seed);
return 0;
}
-#elif defined __linux__ && defined SYS_getrandom
+#elif defined __linux__ && defined __NR_getrandom
#include <linux/random.h>
# ifndef GRND_NONBLOCK
@@ -538,7 +538,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int need_secure)
if (!need_secure)
flags = GRND_NONBLOCK;
errno = 0;
- ret = syscall(SYS_getrandom, seed, size, flags);
+ ret = syscall(__NR_getrandom, seed, size, flags);
if (errno == ENOSYS) {
ATOMIC_SET(try_syscall, 0);
return -1;
@coldnebo
Copy link
Author

coldnebo commented May 3, 2017

same as patch for reported ruby issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment