From 4e2567adfa6b7427eda3876c58de7a683df1c8da Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Sun, 17 Jan 2021 17:45:14 -0800 Subject: [PATCH] Change STRERROR() to be just an alias for strerror() on all platforms Its a terrible idea to modify the return value of strerror() on any platform. strerror() can (and often does) return immutable string constants - don't try to modify that string even if it does end in trailing white-space (find another solution to that). This change only affects non-*nix builds since we were already doing the right thing for *nix. --- src/xpdev/genwrap.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h index 787514c0c1..1b643f7d07 100644 --- a/src/xpdev/genwrap.h +++ b/src/xpdev/genwrap.h @@ -272,11 +272,7 @@ DLLEXPORT char* DLLCALL truncsp_lines(char* str); /* Truncate new-line chars off end of string */ DLLEXPORT char* DLLCALL truncnl(char* str); -#if defined(__unix__) - #define STRERROR(x) strerror(x) -#else - #define STRERROR(x) truncsp(strerror(x)) -#endif +#define STRERROR(x) strerror(x) /* Re-entrant version of strerror() */ DLLEXPORT char* DLLCALL safe_strerror(int errnum, char* buf, size_t buflen); -- GitLab