From 56c3a135b239f4c8ccfdbbb1668880d4c39d5b87 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 11 Jun 2019 15:42:42 -0400 Subject: Add ERR_put_func_error, and use it. Change SYSerr to have the function name; remove SYS_F_xxx defines Add a test and documentation. Use get_last_socket_err, which removes some ifdef's in OpenSSL code. Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9072) --- crypto/bio/bss_file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crypto/bio/bss_file.c') diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 0e07632f7e..d0afd10214 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -69,7 +69,7 @@ BIO *BIO_new_file(const char *filename, const char *mode) fp_flags |= BIO_FP_TEXT; if (file == NULL) { - SYSerr(SYS_F_FOPEN, get_last_sys_error()); + SYSerr("fopen", get_last_sys_error()); ERR_add_error_data(5, "fopen('", filename, "','", mode, "')"); if (errno == ENOENT # ifdef ENXIO @@ -149,7 +149,7 @@ static int file_read(BIO *b, char *out, int outl) if (ret == 0 && (b->flags & BIO_FLAGS_UPLINK_INTERNAL ? UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr))) { - SYSerr(SYS_F_FREAD, get_last_sys_error()); + SYSerr("fread", get_last_sys_error()); BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); ret = -1; } @@ -288,7 +288,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) # endif fp = openssl_fopen(ptr, p); if (fp == NULL) { - SYSerr(SYS_F_FOPEN, get_last_sys_error()); + SYSerr("fopen", get_last_sys_error()); ERR_add_error_data(5, "fopen('", ptr, "','", p, "')"); BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); ret = 0; @@ -316,7 +316,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) st = b->flags & BIO_FLAGS_UPLINK_INTERNAL ? UP_fflush(b->ptr) : fflush((FILE *)b->ptr); if (st == EOF) { - SYSerr(SYS_F_FFLUSH, get_last_sys_error()); + SYSerr("fflush", get_last_sys_error()); ERR_add_error_data(1, "fflush()"); BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); ret = 0; -- cgit v1.2.3