From 07bb0509dd8003df8d094dda0ae182f767dddac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 3 Feb 2006 12:47:01 +0000 Subject: [PATCH] (krb5_get_error_message): peek inside the context and make a copy of the error string. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16696 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/error_string.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/krb5/error_string.c b/lib/krb5/error_string.c index 7567b25bd..7191090c0 100644 --- a/lib/krb5/error_string.c +++ b/lib/krb5/error_string.c @@ -111,9 +111,12 @@ krb5_have_error_string(krb5_context context) char * KRB5_LIB_FUNCTION krb5_get_error_message(krb5_context context, krb5_error_code code) { - char *str; + char *str = NULL; - str = krb5_get_error_string(context); + HEIMDAL_MUTEX_lock(context->mutex); + if (context->error_string) + str = strdup(context->error_string); + HEIMDAL_MUTEX_unlock(context->mutex); if (str) return str;