return (r);
}
-/* Don't use the return value of `strerror_r', because the GNU-people got
- * inventive there.. -octo */
+/* Even though Posix requires "strerror_r" to return an "int",
+ * some systems (e.g. the GNU libc) return a "char *" _and_
+ * ignore the second argument ... -tokkee */
char *sstrerror (int errnum, char *buf, size_t buflen)
{
buf[0] = '\0';
+#ifdef STRERROR_R_CHAR_P
+ {
+ char *temp;
+ temp = strerror_r (errnum, buf, buflen);
+ if (buf[0] == '\0')
+ {
+ strncpy (buf, temp, buflen);
+ buf[buflen - 1] = '\0';
+ }
+ }
+#else
strerror_r (errnum, buf, buflen);
+#endif /* STRERROR_R_CHAR_P */
return (buf);
} /* char *sstrerror */