diff --git a/lib/hdrbg.c b/lib/hdrbg.c index 3ac8f40..f13e79a 100644 --- a/lib/hdrbg.c +++ b/lib/hdrbg.c @@ -31,7 +31,7 @@ hdrbg_err = HDRBG_ERR_NONE; #if defined _WIN32 #include #include -#elif defined __linux__ || defined __APPLE__ +#elif defined __linux__ #include #endif @@ -214,7 +214,7 @@ streamtobytes(FILE *fptr_, uint8_t *m_bytes, size_t m_length) return 0; } return m_length; -#elif (defined __linux__ || defined __APPLE__) && CHAR_BIT == 8 +#elif defined __linux__ && CHAR_BIT == 8 ssize_t len = getrandom(m_bytes, m_length, 0); if(len < 0) { @@ -227,7 +227,7 @@ streamtobytes(FILE *fptr_, uint8_t *m_bytes, size_t m_length) } return len; #else - FILE *fptr = fopen("/dev/urandom"); + FILE *fptr = fopen("/dev/urandom", "rb"); if(fptr == NULL) { hdrbg_err = HDRBG_ERR_NO_ENTROPY;