From bb009412d31aaae01575814791ec806ee2117e2f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Dec 2009 14:39:33 +1100 Subject: heimdal: work around differences between GNU and XSI strerror_r() This is a fairly ugly workaround, but then again, strerror_r() is a very ugly mess. --- source4/heimdal/lib/krb5/fcache.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source4/heimdal/lib') diff --git a/source4/heimdal/lib/krb5/fcache.c b/source4/heimdal/lib/krb5/fcache.c index cda15e483b..bec37b2913 100644 --- a/source4/heimdal/lib/krb5/fcache.c +++ b/source4/heimdal/lib/krb5/fcache.c @@ -374,10 +374,18 @@ fcc_open(krb5_context context, fd = open(filename, flags, mode); if(fd < 0) { char buf[128]; + char *estr; ret = errno; - strerror_r(ret, buf, sizeof(buf)); + buf[0] = 0; + estr = (char *)strerror_r(ret, buf, sizeof(buf)); + if (buf[0] != 0) { + /* we've got the BSD/XSI strerror_r, and it use the + * buffer. Otherwise we have the GNU strerror_r, and + * it used a static string. Ain't standards great? */ + estr = buf; + } krb5_set_error_message(context, ret, N_("open(%s): %s", "file, error"), - filename, buf); + filename, estr); return ret; } rk_cloexec(fd); -- cgit