diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-11-01 22:14:25 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-11-01 22:14:25 +0000 |
commit | cf976d22466992d54689f93e7af9c47786549ccc (patch) | |
tree | 6d3f9c7dd9471fe1a140414af1b55e1d6f1fb07d /src/util | |
parent | 37236a935f20a04b07c2b62525e051c171165b69 (diff) | |
download | krb5-cf976d22466992d54689f93e7af9c47786549ccc.tar.gz krb5-cf976d22466992d54689f93e7af9c47786549ccc.tar.xz krb5-cf976d22466992d54689f93e7af9c47786549ccc.zip |
Be a little more const-correct in krb5int_vset_error_fl
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23117 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/support/errors.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/util/support/errors.c b/src/util/support/errors.c index e89d8ad456..2671a4521f 100644 --- a/src/util/support/errors.c +++ b/src/util/support/errors.c @@ -68,20 +68,17 @@ krb5int_vset_error_fl (struct errinfo *ep, long code, { va_list args2; char *str = NULL, *str2, *slash; - const char *loc_fmt = NULL; - #ifdef USE_KIM + kim_string loc_fmt = NULL; + /* Try to localize the format string */ - if (kim_os_string_create_localized(&loc_fmt, fmt) != KIM_NO_ERROR) { - loc_fmt = fmt; - } -#else - loc_fmt = fmt; + if (kim_os_string_create_localized(&loc_fmt, fmt) == KIM_NO_ERROR) + fmt = loc_fmt; #endif /* try vasprintf first */ va_copy(args2, args); - if (vasprintf(&str, loc_fmt, args2) < 0) { + if (vasprintf(&str, fmt, args2) < 0) { str = NULL; } va_end(args2); @@ -99,22 +96,20 @@ krb5int_vset_error_fl (struct errinfo *ep, long code, /* If that failed, try using scratch_buf */ if (str == NULL) { - vsnprintf(ep->scratch_buf, sizeof(ep->scratch_buf), loc_fmt, args); + vsnprintf(ep->scratch_buf, sizeof(ep->scratch_buf), fmt, args); str = strdup(ep->scratch_buf); /* try allocating again */ } /* free old string before setting new one */ if (ep->msg && ep->msg != ep->scratch_buf) { - free ((char *) ep->msg); + krb5int_free_error (ep, ep->msg); ep->msg = NULL; } ep->code = code; ep->msg = str ? str : ep->scratch_buf; #ifdef USE_KIM - if (loc_fmt != fmt) { kim_string_free(&loc_fmt); } -#else - if (loc_fmt != fmt) { free((char *) loc_fmt); } + kim_string_free(&loc_fmt); #endif } |