summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2017-02-07 03:11:11 +0000
committerbeck <>2017-02-07 03:11:11 +0000
commit3a01eccf92ccc906d63dbed91bd91ab7418724bc (patch)
tree9164bb2ab281fe1ae38cbafe4c17dadf342cb5f5 /src
parent91c389f89015a024212e73f5ec6e24166955ab6e (diff)
downloadopenbsd-3a01eccf92ccc906d63dbed91bd91ab7418724bc.tar.gz
openbsd-3a01eccf92ccc906d63dbed91bd91ab7418724bc.tar.bz2
openbsd-3a01eccf92ccc906d63dbed91bd91ab7418724bc.zip
Add file and line to the LibreSSL error strings sine we are no longer in
1989, VMS, or MS/DOS and we all run Brobdingnagian C compilers that have can now be counted on to achieve this level of sophistication nearly everywhere. ok jsing@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/err/err.c21
-rw-r--r--src/lib/libcrypto/err/err_prn.c6
2 files changed, 20 insertions, 7 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 292805433d..dcf725fd64 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.42 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: err.c,v 1.43 2017/02/07 03:11:11 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 *
@@ -862,8 +862,9 @@ void
862ERR_error_string_n(unsigned long e, char *buf, size_t len) 862ERR_error_string_n(unsigned long e, char *buf, size_t len)
863{ 863{
864 char lsbuf[30], fsbuf[30], rsbuf[30]; 864 char lsbuf[30], fsbuf[30], rsbuf[30];
865 const char *ls, *fs, *rs; 865 const char *ls, *fs, *rs, *file, *data;
866 int l, f, r, ret; 866 int l, f, r, ret, line, flags;
867
867 868
868 l = ERR_GET_LIB(e); 869 l = ERR_GET_LIB(e);
869 f = ERR_GET_FUNC(e); 870 f = ERR_GET_FUNC(e);
@@ -886,7 +887,19 @@ ERR_error_string_n(unsigned long e, char *buf, size_t len)
886 rs = rsbuf; 887 rs = rsbuf;
887 } 888 }
888 889
889 ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); 890 if (ERR_get_error_line_data(&file, &line, &data, &flags) != 0) {
891 const char *filename;
892
893 if ((filename = strrchr(file, '/')) != NULL)
894 filename++;
895 else
896 filename = file;
897
898 ret = snprintf(buf, len, "error:%08lX:%s:%s:%s:%s:%d", e, ls,
899 fs, rs, filename, line);
900 } else
901 ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs);
902
890 if (ret == -1) 903 if (ret == -1)
891 return; /* can't happen, and can't do better if it does */ 904 return; /* can't happen, and can't do better if it does */
892 if (ret >= len) { 905 if (ret >= len) {
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c
index 021bcd5d1d..6a3062a89a 100644
--- a/src/lib/libcrypto/err/err_prn.c
+++ b/src/lib/libcrypto/err/err_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err_prn.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: err_prn.c,v 1.17 2017/02/07 03:11:11 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 *
@@ -80,8 +80,8 @@ ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u)
80 while ((l = ERR_get_error_line_data(&file, &line, &data, 80 while ((l = ERR_get_error_line_data(&file, &line, &data,
81 &flags)) != 0) { 81 &flags)) != 0) {
82 ERR_error_string_n(l, buf, sizeof buf); 82 ERR_error_string_n(l, buf, sizeof buf);
83 (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, 83 (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s\n", es,
84 buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); 84 buf, (flags & ERR_TXT_STRING) ? data : "");
85 if (cb(buf2, strlen(buf2), u) <= 0) 85 if (cb(buf2, strlen(buf2), u) <= 0)
86 break; /* abort outputting the error report */ 86 break; /* abort outputting the error report */
87 } 87 }