about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ulid.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ulid.c b/ulid.c
index dde7add..06d2eb6 100644
--- a/ulid.c
+++ b/ulid.c
@@ -7,12 +7,11 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-#include <sys/random.h>
-
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <unistd.h>
 
 void
 ulidgen_r(char ulid[27])
@@ -53,7 +52,7 @@ ulidgen_r(char ulid[27])
 	}
 
 	unsigned char rnd[16];  /* use 16 bytes for easier encoding */
-	if (getrandom(rnd, sizeof rnd, 0) < 0)
+	if (getentropy(rnd, sizeof rnd) < 0)
 		abort();
 
 	for (int i = 0; i < 16; i++)