diff options
author | Nicholas Tay <nick@windblume.net> | 2022-01-10 15:30:44 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-01-10 15:30:44 +1100 |
commit | 59afa1af29c192b7a00777ab093814aa20f546ad (patch) | |
tree | 78af122b82e7e35fb84610fcadacb079248580f7 | |
parent | 9f9903f90443e30eaa39c096257f5eb9fca04101 (diff) | |
download | passgen-59afa1af29c192b7a00777ab093814aa20f546ad.tar.gz passgen-59afa1af29c192b7a00777ab093814aa20f546ad.tar.bz2 passgen-59afa1af29c192b7a00777ab093814aa20f546ad.zip |
Switch to getentropy C api (to port to macOS)
-rw-r--r-- | passgen.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -4,6 +4,7 @@ #include <stdlib.h> #include <stdbool.h> #include <string.h> +#include <unistd.h> #ifdef __linux__ #include <sys/random.h> @@ -12,8 +13,6 @@ #if defined (_WIN32) && ! defined (__MINGW32__) #include <io.h> -#elif ! defined (__linux__) -#include <unistd.h> #endif #endif @@ -113,7 +112,7 @@ int main(int argc, char *argv[]) do { #ifdef __linux__ unsigned int r; - getrandom(&r, sizeof(r), 0); + getentropy(&r, sizeof(r)); #else long r = rand(); #endif |