diff options
author | Nicholas Tay <nick@windblume.net> | 2022-01-11 17:17:38 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-01-11 17:17:38 +1100 |
commit | 1eefc325594333bd3bc58006acb641a28d465606 (patch) | |
tree | b80a1e8117d32807c7b8f50067665e31e8a12217 /passgen.c | |
parent | 59afa1af29c192b7a00777ab093814aa20f546ad (diff) | |
download | passgen-1eefc325594333bd3bc58006acb641a28d465606.tar.gz passgen-1eefc325594333bd3bc58006acb641a28d465606.tar.bz2 passgen-1eefc325594333bd3bc58006acb641a28d465606.zip |
Use getentropy on macOS
Diffstat (limited to 'passgen.c')
-rw-r--r-- | passgen.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -6,7 +6,7 @@ #include <string.h> #include <unistd.h> -#ifdef __linux__ +#if defined (__linux__) || defined (__APPLE__) #include <sys/random.h> #else #include <time.h> @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) } password[grammar_size] = 0; -#ifndef __linux__ +#if ! defined (__linux__) && ! defined (__APPLE__) /* * TODO: seed better RNG * this isn't very good, but it's enough(?) for now @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) } do { -#ifdef __linux__ +#if defined (__linux__) || defined (__APPLE__) unsigned int r; getentropy(&r, sizeof(r)); #else |