diff options
author | markus <> | 2002-09-05 12:51:50 +0000 |
---|---|---|
committer | markus <> | 2002-09-05 12:51:50 +0000 |
commit | 15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch) | |
tree | bf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/err/err_prn.c | |
parent | 027351f729b9e837200dae6e1520cda6577ab930 (diff) | |
download | openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2 openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip |
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/err/err_prn.c')
-rw-r--r-- | src/lib/libcrypto/err/err_prn.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c index ecd0e7c4fa..c156663f0e 100644 --- a/src/lib/libcrypto/err/err_prn.c +++ b/src/lib/libcrypto/err/err_prn.c | |||
@@ -57,51 +57,51 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "lhash.h" | 60 | #include <openssl/lhash.h> |
61 | #include "crypto.h" | 61 | #include <openssl/crypto.h> |
62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | #include "buffer.h" | 63 | #include <openssl/buffer.h> |
64 | #include "err.h" | 64 | #include <openssl/err.h> |
65 | #include "crypto.h" | 65 | #include <openssl/crypto.h> |
66 | 66 | ||
67 | #ifndef NO_FP_API | 67 | void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), |
68 | void ERR_print_errors_fp(fp) | 68 | void *u) |
69 | FILE *fp; | ||
70 | { | 69 | { |
71 | unsigned long l; | 70 | unsigned long l; |
72 | char buf[200]; | 71 | char buf[256]; |
73 | char *file,*data; | 72 | char buf2[4096]; |
73 | const char *file,*data; | ||
74 | int line,flags; | 74 | int line,flags; |
75 | unsigned long es; | 75 | unsigned long es; |
76 | 76 | ||
77 | es=CRYPTO_thread_id(); | 77 | es=CRYPTO_thread_id(); |
78 | while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) | 78 | while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) |
79 | { | 79 | { |
80 | fprintf(fp,"%lu:%s:%s:%d:%s\n",es,ERR_error_string(l,buf), | 80 | ERR_error_string_n(l, buf, sizeof buf); |
81 | file,line,(flags&ERR_TXT_STRING)?data:""); | 81 | BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, |
82 | file, line, (flags & ERR_TXT_STRING) ? data : ""); | ||
83 | cb(buf2, strlen(buf2), u); | ||
82 | } | 84 | } |
83 | } | 85 | } |
84 | #endif | ||
85 | 86 | ||
86 | void ERR_print_errors(bp) | 87 | #ifndef OPENSSL_NO_FP_API |
87 | BIO *bp; | 88 | static int print_fp(const char *str, size_t len, void *fp) |
88 | { | 89 | { |
89 | unsigned long l; | 90 | return fprintf((FILE *)fp, "%s", str); |
90 | char buf[256]; | 91 | } |
91 | char buf2[256]; | 92 | void ERR_print_errors_fp(FILE *fp) |
92 | char *file,*data; | 93 | { |
93 | int line,flags; | 94 | ERR_print_errors_cb(print_fp, fp); |
94 | unsigned long es; | 95 | } |
96 | #endif | ||
95 | 97 | ||
96 | es=CRYPTO_thread_id(); | 98 | static int print_bio(const char *str, size_t len, void *bp) |
97 | while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) | 99 | { |
98 | { | 100 | return BIO_write((BIO *)bp, str, len); |
99 | sprintf(buf2,"%lu:%s:%s:%d:",es,ERR_error_string(l,buf), | 101 | } |
100 | file,line); | 102 | void ERR_print_errors(BIO *bp) |
101 | BIO_write(bp,buf2,strlen(buf2)); | 103 | { |
102 | if (flags & ERR_TXT_STRING) | 104 | ERR_print_errors_cb(print_bio, bp); |
103 | BIO_write(bp,data,strlen(data)); | ||
104 | BIO_write(bp,"\n",1); | ||
105 | } | ||
106 | } | 105 | } |
107 | 106 | ||
107 | |||