diff --git a/src/libstrongswan/utils.c b/src/libstrongswan/utils.c index f613b0c647..8c0c7f46c5 100644 --- a/src/libstrongswan/utils.c +++ b/src/libstrongswan/utils.c @@ -254,6 +254,8 @@ const char *safe_strerror(int errnum) return msg; } #else /* HAVE_STRERROR_R */ +/* we actually wan't to call strerror(3) below */ +#undef strerror /* * Described in header. */ diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 954925dab7..c671a2e08a 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -422,6 +422,11 @@ bool mkdir_p(const char *path, mode_t mode); */ const char *safe_strerror(int errnum); +/** + * Replace usages of strerror(3) with thread-safe variant. + */ +#define strerror(errnum) safe_strerror(errnum) + #ifndef HAVE_CLOSEFROM /** * Close open file descriptors greater than or equal to lowfd.