catch error from as.*printf

This commit is contained in:
Love Hornquist Astrand
2010-05-30 13:37:07 -07:00
parent 788189805c
commit 077357c848
6 changed files with 23 additions and 16 deletions

View File

@@ -46,6 +46,7 @@ _warnerr(krb5_context context, int do_errtext,
const char *args[2], **arg;
char *msg = NULL;
const char *err_str = NULL;
krb5_error_code ret;
args[0] = args[1] = NULL;
arg = args;
@@ -53,8 +54,8 @@ _warnerr(krb5_context context, int do_errtext,
strlcat(xfmt, "%s", sizeof(xfmt));
if(do_errtext)
strlcat(xfmt, ": ", sizeof(xfmt));
vasprintf(&msg, fmt, ap);
if(msg == NULL)
ret = vasprintf(&msg, fmt, ap);
if(ret < 0 || msg == NULL)
return ENOMEM;
*arg++ = msg;
}