summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bss_file.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/bio/bss_file.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/bio/bss_file.c')
-rw-r--r--src/lib/libcrypto/bio/bss_file.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c
index c710076fea..01f4a3ff3b 100644
--- a/src/lib/libcrypto/bio/bss_file.c
+++ b/src/lib/libcrypto/bio/bss_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_file.c,v 1.31 2014/11/11 19:26:12 miod Exp $ */ 1/* $OpenBSD: bss_file.c,v 1.32 2017/01/29 17:49:22 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -119,12 +119,12 @@ BIO_new_file(const char *filename, const char *mode)
119 file = fopen(filename, mode); 119 file = fopen(filename, mode);
120 120
121 if (file == NULL) { 121 if (file == NULL) {
122 SYSerr(SYS_F_FOPEN, errno); 122 SYSerror(errno);
123 ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode); 123 ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode);
124 if (errno == ENOENT) 124 if (errno == ENOENT)
125 BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE); 125 BIOerror(BIO_R_NO_SUCH_FILE);
126 else 126 else
127 BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB); 127 BIOerror(ERR_R_SYS_LIB);
128 return (NULL); 128 return (NULL);
129 } 129 }
130 if ((ret = BIO_new(BIO_s_file())) == NULL) { 130 if ((ret = BIO_new(BIO_s_file())) == NULL) {
@@ -188,8 +188,8 @@ file_read(BIO *b, char *out, int outl)
188 if (b->init && out != NULL) { 188 if (b->init && out != NULL) {
189 ret = fread(out, 1, outl, (FILE *)b->ptr); 189 ret = fread(out, 1, outl, (FILE *)b->ptr);
190 if (ret == 0 && ferror((FILE *)b->ptr)) { 190 if (ret == 0 && ferror((FILE *)b->ptr)) {
191 SYSerr(SYS_F_FREAD, errno); 191 SYSerror(errno);
192 BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); 192 BIOerror(ERR_R_SYS_LIB);
193 ret = -1; 193 ret = -1;
194 } 194 }
195 } 195 }
@@ -246,15 +246,15 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr)
246 else if (num & BIO_FP_READ) 246 else if (num & BIO_FP_READ)
247 strlcpy(p, "r", sizeof p); 247 strlcpy(p, "r", sizeof p);
248 else { 248 else {
249 BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE); 249 BIOerror(BIO_R_BAD_FOPEN_MODE);
250 ret = 0; 250 ret = 0;
251 break; 251 break;
252 } 252 }
253 fp = fopen(ptr, p); 253 fp = fopen(ptr, p);
254 if (fp == NULL) { 254 if (fp == NULL) {
255 SYSerr(SYS_F_FOPEN, errno); 255 SYSerror(errno);
256 ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p); 256 ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p);
257 BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); 257 BIOerror(ERR_R_SYS_LIB);
258 ret = 0; 258 ret = 0;
259 break; 259 break;
260 } 260 }