summaryrefslogtreecommitdiffstats
path: root/src/util/support/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/support/errors.c')
-rw-r--r--src/util/support/errors.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/util/support/errors.c b/src/util/support/errors.c
index 36ea11c3a..d1aa485c5 100644
--- a/src/util/support/errors.c
+++ b/src/util/support/errors.c
@@ -85,9 +85,11 @@ krb5int_get_error (struct errinfo *ep, long code)
ep->msg = NULL;
return ep->scratch_buf;
}
- lock();
+ if (lock())
+ goto no_fptr;
if (fptr == NULL) {
unlock();
+ no_fptr:
#ifdef HAVE_STRERROR_R
if (strerror_r (code, ep->scratch_buf, sizeof(ep->scratch_buf)) == 0) {
char *p = strdup(ep->scratch_buf);
@@ -157,7 +159,8 @@ void
krb5int_set_error_info_callout_fn (const char *(KRB5_CALLCONV *f)(long))
{
initialize();
- lock();
- fptr = f;
- unlock();
+ if (lock() == 0) {
+ fptr = f;
+ unlock();
+ }
}