Probably an elementary question stemming from my lack of C expertise.
I am trying to complile some C code that includes its own "bcrypt"
function. This is conflicting with the declaration in pwd.h.
error: conflicting types for 'bcrypt'
int bcrypt(char *, const char *, const char *);
^
/usr/include/pwd.h:112:8: note: previous declaration is here
char *bcrypt(const char *, const char *);
In pwd.h I see that the bcrypt declaration is wrapped in a #if block:
#if __BSD_VISIBLE
int setpassent(int);
int uid_from_user(const char *, uid_t *);
const char *user_from_uid(uid_t, int);
char *bcrypt_gensalt(u_int8_t);
char *bcrypt(const char *, const char *);
int bcrypt_newhash(const char *, int, char *, size_t);
int bcrypt_checkpass(const char *, const char *);
struct passwd *pw_dup(const struct passwd *);
#endif
So I'm trying to work out why __BSD_VISIBLE is 1 when I'm compiling.
sys/cdefs.h says:
/*
* Finally deal with BSD-specific interfaces that are not covered
* by any standards. We expose these when none of the POSIX or XPG
* macros is defined or if the user explicitly asks for them.
*/
#if !defined(_BSD_SOURCE) && \
(defined(_ANSI_SOURCE) || defined(__XPG_VISIBLE) ||
defined(__POSIX_VISIBLE))
# define __BSD_VISIBLE 0
#endif
__POSIX_VISIBLE is defined as 200809, so __BSD_VISIBLE should be 0 and
the pwd.h declaration for bcrypt should be skipped?
Allan