Skip to content

Commit 75179de

Browse files
authored
Merge pull request #1056 from fd00/use-dev-urandom-on-cygwin
Use `/dev/urandom` for `janet_cryptorand` on cygwin
2 parents c28df14 + 3254c2c commit 75179de

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/core/util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ int janet_cryptorand(uint8_t *out, size_t n) {
869869
}
870870
}
871871
return 0;
872-
#elif defined(JANET_LINUX) || ( defined(JANET_APPLE) && !defined(MAC_OS_X_VERSION_10_7) )
872+
#elif defined(JANET_LINUX) || defined(JANET_CYGWIN) || ( defined(JANET_APPLE) && !defined(MAC_OS_X_VERSION_10_7) )
873873
/* We should be able to call getrandom on linux, but it doesn't seem
874874
to be uniformly supported on linux distros.
875875
On Mac, arc4random_buf wasn't available on until 10.7.

src/include/janet.h

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ extern "C" {
6767
#define JANET_LINUX 1
6868
#endif
6969

70+
/* Check for Cygwin */
71+
#if defined(__CYGWIN__)
72+
#define JANET_CYGWIN 1
73+
#endif
74+
7075
/* Check Unix */
7176
#if defined(_AIX) \
7277
|| defined(__APPLE__) /* Darwin */ \

0 commit comments

Comments
 (0)