Commit 01b77f0dcf7f43fe598d5f6aa34f9edfad418432

Guillem Jover 2015-12-02T03:32:13

Add support for GNU/kFreeBSD for closefrom() and getentropy()

diff --git a/src/closefrom.c b/src/closefrom.c
index c2922e7..962af79 100644
--- a/src/closefrom.c
+++ b/src/closefrom.c
@@ -136,7 +136,7 @@ closefrom_procfs(int lowfd)
 	int i;
 
 	/* Use /proc/self/fd (or /dev/fd on FreeBSD) if it exists. */
-# if defined(__FreeBSD__) || defined(__APPLE__)
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
 	path = "/dev/fd";
 # else
 	path = "/proc/self/fd";
diff --git a/src/getentropy.c b/src/getentropy.c
index f22b850..be19d7e 100644
--- a/src/getentropy.c
+++ b/src/getentropy.c
@@ -26,7 +26,7 @@
 
 #if defined(__linux__)
 #include "getentropy_linux.c"
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include "arc4random_bsd.c"
 #elif defined(__NetBSD__)
 #include "arc4random_bsd.c"