about summary refs log tree commit diff
path: root/ulid.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-10-02 18:38:26 +0200
committerLeah Neukirchen <leah@vuxu.org>2024-10-02 18:38:26 +0200
commitb47ca7881db8807e7601bcdecb9b61294a186810 (patch)
tree43683d9d198ef8253d11343868efc10c0659f999 /ulid.c
parent945bc437108bd0bec6ffbd4e62d2eb5a4e7ba941 (diff)
downloadulidgen-master.tar.gz
ulidgen-master.tar.xz
ulidgen-master.zip
use POSIX-2024 getentropy HEAD master
Diffstat (limited to 'ulid.c')
-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++)