Skip to content

Commit

Permalink
stress-crypt: fix FreeBSD build issues
Browse files Browse the repository at this point in the history
FreeBSD has crypt() and associated crypt structs declared in <unistd.h>
so fix libcrypt detection and builds for FreeBSD to not use <crypt.h>

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Jan 12, 2024
1 parent 1461231 commit b4b810d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stress-crypt.c
Expand Up @@ -31,7 +31,8 @@ static const stress_help_t help[] = {
};

#if defined(HAVE_LIB_CRYPT) && \
defined(HAVE_CRYPT_H)
(defined(HAVE_CRYPT_H) || \
defined(__FreeBSD__))

typedef struct {
const char *prefix;
Expand Down
4 changes: 4 additions & 0 deletions test/test-libcrypt.c
Expand Up @@ -21,7 +21,11 @@
#define _XOPEN_SOURCE 600

#include <string.h>
#if defined(__FreeBSD__)
#include <unistd.h>
#else
#include <crypt.h>
#endif

int main(void)
{
Expand Down

0 comments on commit b4b810d

Please sign in to comment.