summaryrefslogtreecommitdiffstats
path: root/src/util/support
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2008-07-22 19:34:24 +0000
committerKen Raeburn <raeburn@mit.edu>2008-07-22 19:34:24 +0000
commit4480e0df2a3d2fe2b63770e61d9cfd9fbe7d36fb (patch)
tree67146989d784ae02cfee1b3595b2a5c8a7366b62 /src/util/support
parentae629b14a7d2f1564d09f3ef49998ec7e35d2a27 (diff)
downloadkrb5-4480e0df2a3d2fe2b63770e61d9cfd9fbe7d36fb.tar.gz
krb5-4480e0df2a3d2fe2b63770e61d9cfd9fbe7d36fb.tar.xz
krb5-4480e0df2a3d2fe2b63770e61d9cfd9fbe7d36fb.zip
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
Diffstat (limited to 'src/util/support')
-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();
+ }
}