(_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] = "";
const char *args[2], **arg;
char *msg = NULL;
char *err_str = NULL;
args[0] = args[1] = NULL;
arg = args;
@@ -64,18 +65,24 @@ _warnerr(krb5_context context, int do_errtext,
strcat(xfmt, "%s");
err_str = krb5_get_error_string(context);
if (err_str != NULL) {
*arg++ = err_str;
} else {
err_msg = krb5_get_err_text(context, code);
if (err_msg)
*arg++ = err_msg;
else
*arg++ = "<unknown error>";
}
}
if(context && context->warn_dest)
krb5_log(context, context->warn_dest, level, xfmt, args[0], args[1]);
else
warnx(xfmt, args[0], args[1]);
free(msg);
free(err_str);
return 0;
}