diff options
Diffstat (limited to 'crypto/err/err_prn.c')
-rw-r--r-- | crypto/err/err_prn.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/err/err_prn.c b/crypto/err/err_prn.c index 4cdf342fa634..1e46f93ecf81 100644 --- a/crypto/err/err_prn.c +++ b/crypto/err/err_prn.c @@ -79,14 +79,20 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), ERR_error_string_n(l, buf, sizeof buf); BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); - cb(buf2, strlen(buf2), u); + if (cb(buf2, strlen(buf2), u) <= 0) + break; /* abort outputting the error report */ } } #ifndef OPENSSL_NO_FP_API static int print_fp(const char *str, size_t len, void *fp) { - return fwrite(str, 1, len, fp); + BIO bio; + + BIO_set(&bio,BIO_s_file()); + BIO_set_fp(&bio,fp,BIO_NOCLOSE); + + return BIO_printf(&bio, "%s", str); } void ERR_print_errors_fp(FILE *fp) { |