From 4480e0df2a3d2fe2b63770e61d9cfd9fbe7d36fb Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 22 Jul 2008 19:34:24 +0000 Subject: Catch a few more cases of unchecked k5_mutex_lock calls ticket: 5962 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20567 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/support/errors.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/util/support/errors.c') 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(); + } } -- cgit