diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-11 14:39:33 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-14 22:29:57 +1100 |
commit | bb009412d31aaae01575814791ec806ee2117e2f (patch) | |
tree | 9262b565aafb5374183209d8158f1dd7c8684a7c /source4/heimdal/lib/krb5 | |
parent | 665e57f956b23501fc73ac0b099dc3cdcfc1740b (diff) | |
download | samba-bb009412d31aaae01575814791ec806ee2117e2f.tar.gz samba-bb009412d31aaae01575814791ec806ee2117e2f.tar.xz samba-bb009412d31aaae01575814791ec806ee2117e2f.zip |
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.
Diffstat (limited to 'source4/heimdal/lib/krb5')
-rw-r--r-- | source4/heimdal/lib/krb5/fcache.c | 12 |
1 files changed, 10 insertions, 2 deletions
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); |