Skip to content

Commit

Permalink
Cygwin defines __CYGWIN__, not __linux__ or _WIN32.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Oct 1, 2023
1 parent c6260a0 commit db8d1f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hdrbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ hdrbg_err = HDRBG_ERR_NONE;
#if defined _WIN32
#include <windows.h>
#include <bcrypt.h>
#elif defined __linux__
#elif defined __linux__ || defined __CYGWIN__
#include <sys/random.h>
#endif

Expand Down Expand Up @@ -214,7 +214,7 @@ streamtobytes(FILE *fptr_, uint8_t *m_bytes, size_t m_length)
return 0;
}
return m_length;
#elif defined __linux__ && CHAR_BIT == 8
#elif (defined __linux__ || defined __CYGWIN__) && CHAR_BIT == 8
ssize_t len = getrandom(m_bytes, m_length, 0);
if(len < 0)
{
Expand Down

0 comments on commit db8d1f6

Please sign in to comment.