(_warnerr): print error_string in context in preference to error

string derived from error code


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9859 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-05-07 21:04:34 +00:00
parent 7044554aa1
commit 5618fc25a4

View File

@@ -47,6 +47,7 @@ _warnerr(krb5_context context, int do_errtext,
char xfmt[7] = ""; char xfmt[7] = "";
const char *args[2], **arg; const char *args[2], **arg;
char *msg = NULL; char *msg = NULL;
char *err_str = NULL;
args[0] = args[1] = NULL; args[0] = args[1] = NULL;
arg = args; arg = args;
@@ -64,11 +65,16 @@ _warnerr(krb5_context context, int do_errtext,
strcat(xfmt, "%s"); strcat(xfmt, "%s");
err_msg = krb5_get_err_text(context, code); err_str = krb5_get_error_string(context);
if (err_msg) if (err_str != NULL) {
*arg++ = err_msg; *arg++ = err_str;
else } else {
*arg++ = "<unknown error>"; err_msg = krb5_get_err_text(context, code);
if (err_msg)
*arg++ = err_msg;
else
*arg++ = "<unknown error>";
}
} }
if(context && context->warn_dest) if(context && context->warn_dest)
@@ -76,6 +82,7 @@ _warnerr(krb5_context context, int do_errtext,
else else
warnx(xfmt, args[0], args[1]); warnx(xfmt, args[0], args[1]);
free(msg); free(msg);
free(err_str);
return 0; return 0;
} }