summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-02-07 15:52:34 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-02-07 15:52:34 +0000
commiteb6ecbbb0bdc89c9ead50e37fdef10fcff0564e9 (patch)
tree1ed4377cc26dac52110d55643f9456bbfa2bcd6b /lib/libcrypto
parent1253329041c0d34d481492f4eb1374370ec26d7b (diff)
Revert previous; the implementation is incorrect since it assumes that the
provided error code matches the error that is currently on the top of the error stack.
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/err/err.c21
-rw-r--r--lib/libcrypto/err/err_prn.c6
2 files changed, 7 insertions, 20 deletions
diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c
index dcf725fd641..1b235c16539 100644
--- a/lib/libcrypto/err/err.c
+++ b/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: err.c,v 1.43 2017/02/07 03:11:11 beck Exp $ */
+/* $OpenBSD: err.c,v 1.44 2017/02/07 15:52:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -862,9 +862,8 @@ void
ERR_error_string_n(unsigned long e, char *buf, size_t len)
{
char lsbuf[30], fsbuf[30], rsbuf[30];
- const char *ls, *fs, *rs, *file, *data;
- int l, f, r, ret, line, flags;
-
+ const char *ls, *fs, *rs;
+ int l, f, r, ret;
l = ERR_GET_LIB(e);
f = ERR_GET_FUNC(e);
@@ -887,19 +886,7 @@ ERR_error_string_n(unsigned long e, char *buf, size_t len)
rs = rsbuf;
}
- if (ERR_get_error_line_data(&file, &line, &data, &flags) != 0) {
- const char *filename;
-
- if ((filename = strrchr(file, '/')) != NULL)
- filename++;
- else
- filename = file;
-
- ret = snprintf(buf, len, "error:%08lX:%s:%s:%s:%s:%d", e, ls,
- fs, rs, filename, line);
- } else
- ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs);
-
+ ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs);
if (ret == -1)
return; /* can't happen, and can't do better if it does */
if (ret >= len) {
diff --git a/lib/libcrypto/err/err_prn.c b/lib/libcrypto/err/err_prn.c
index 6a3062a89ae..48166829d44 100644
--- a/lib/libcrypto/err/err_prn.c
+++ b/lib/libcrypto/err/err_prn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: err_prn.c,v 1.17 2017/02/07 03:11:11 beck Exp $ */
+/* $OpenBSD: err_prn.c,v 1.18 2017/02/07 15:52:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -80,8 +80,8 @@ ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u)
while ((l = ERR_get_error_line_data(&file, &line, &data,
&flags)) != 0) {
ERR_error_string_n(l, buf, sizeof buf);
- (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s\n", es,
- buf, (flags & ERR_TXT_STRING) ? data : "");
+ (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es,
+ buf, file, line, (flags & ERR_TXT_STRING) ? data : "");
if (cb(buf2, strlen(buf2), u) <= 0)
break; /* abort outputting the error report */
}