diff --git a/krb5/include/autoconf.h b/krb5/include/autoconf.h --- a/krb5/include/autoconf.h +++ b/krb5/include/autoconf.h @@ -691,7 +691,18 @@ #define STDC_HEADERS 1 /* Define to 1 if strerror_r returns char *. */ +/* + * glibc defines two versions of strerror_r, the char* returning one is used + * when _GNU_SOURCE is defined. + */ +#if defined(__linux__) && __has_include() +#include /* get __GLIBC__ */ +#endif +#if defined(__GLIBC__) && defined(__USE_GNU) +#define STRERROR_R_CHAR_P 1 +#else /* #undef STRERROR_R_CHAR_P */ +#endif /* Define if sys_errlist is defined in errno.h */ #define SYS_ERRLIST_DECLARED 1 diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -38,6 +38,8 @@ # bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely # noisy when building on Linux. CWARNFLAGS+= -Wno-system-headers +# Catch mismatched int/pointer types (e.g. glibc's char* strerror_r prototype) +CWARNFLAGS+= -Werror=int-conversion CWARNFLAGS.clang+=-Werror=incompatible-pointer-types-discards-qualifiers # b64_pton and b64_ntop is in libresolv on MacOS and Linux: