aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-01-11 17:17:38 +1100
committerNicholas Tay <nick@windblume.net>2022-01-11 17:17:38 +1100
commit1eefc325594333bd3bc58006acb641a28d465606 (patch)
treeb80a1e8117d32807c7b8f50067665e31e8a12217
parent59afa1af29c192b7a00777ab093814aa20f546ad (diff)
downloadpassgen-1eefc325594333bd3bc58006acb641a28d465606.tar.gz
passgen-1eefc325594333bd3bc58006acb641a28d465606.tar.bz2
passgen-1eefc325594333bd3bc58006acb641a28d465606.zip
Use getentropy on macOS
-rw-r--r--passgen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/passgen.c b/passgen.c
index 2220be6..af51d4f 100644
--- a/passgen.c
+++ b/passgen.c
@@ -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