summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gss_err.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gss_err.c b/src/gss_err.c
index 712203d..321ed90 100644
--- a/src/gss_err.c
+++ b/src/gss_err.c
@@ -42,12 +42,29 @@ uint32_t gssntlm_display_status(uint32_t *minor_status,
goto done;
}
+ /* handle both XSI and GNU specific varints of strerror_r */
errno = 0;
+#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
+ /* XSI version */
err = strerror_r(status_value, buf, 400);
/* The XSI-compliant strerror_r() function returns 0 on success.
* On error, a (positive) error number is returned (since glibc
* 2.13), or -1 is returned and errno is set to indicate the
* error (glibc versions before 2.13). */
+#else
+ {
+ char *ret;
+ ret = strerror_r(errnum, buf, 400);
+ if (ret == NULL) {
+ err = errno;
+ } else {
+ if (ret != buf) {
+ memmove(buf, ret, strlen(ret) + 1);
+ }
+ err = 0;
+ }
+ }
+#endif
if (err == -1) err = errno;
switch (err) {
case ERANGE: