summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae03d74)
raw | patch | inline | side by side (parent: ae03d74)
author | Florian Forster <octo@huhu.verplant.org> | |
Fri, 26 Oct 2007 08:50:43 +0000 (10:50 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Fri, 26 Oct 2007 08:50:43 +0000 (10:50 +0200) |
Apparently this is a problem under Solaris 9..
src/common.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 974a29eac035afca6a158deafbe4e56bfae2be52..1138f96ff92e688063990c1bdd084eca816fbb47 100644 (file)
--- a/src/common.c
+++ b/src/common.c
static pthread_mutex_t getpwnam_r_lock = PTHREAD_MUTEX_INITIALIZER;
#endif
+#if !HAVE_STRERROR_R
+static pthread_mutex_t strerror_r_lock = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
void sstrncpy (char *d, const char *s, int len)
{
strncpy (d, s, len);
char *sstrerror (int errnum, char *buf, size_t buflen)
{
buf[0] = '\0';
-#ifdef STRERROR_R_CHAR_P
+
+#if !HAVE_STRERROR_R
+ {
+ char *temp;
+
+ pthread_mutex_lock (&strerror_r_lock);
+
+ temp = strerror (errnum);
+ strncpy (buf, temp, buflen);
+
+ pthread_mutex_unlock (&strerror_r_lock);
+ }
+/* #endif !HAVE_STRERROR_R */
+
+#elif STRERROR_R_CHAR_P
{
char *temp;
temp = strerror_r (errnum, buf, buflen);
else
strncpy (buf, "strerror_r did not return "
"an error message", buflen);
- buf[buflen - 1] = '\0';
}
}
+/* #endif STRERROR_R_CHAR_P */
+
#else
if (strerror_r (errnum, buf, buflen) != 0)
{
errnum);
}
#endif /* STRERROR_R_CHAR_P */
+
buf[buflen - 1] = '\0';
return (buf);
} /* char *sstrerror */