summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/errstr.c
diff options
context:
space:
mode:
authortb <>2023-07-23 11:20:11 +0000
committertb <>2023-07-23 11:20:11 +0000
commita50c7c74b92512423af455aa73f495ebf050f4a3 (patch)
treef07e7db5afdc1f539d999e6a3cb6c69ceb2716f9 /src/usr.bin/openssl/errstr.c
parent729e35d2be4f278d1700e348499088f1b459db97 (diff)
downloadopenbsd-a50c7c74b92512423af455aa73f495ebf050f4a3.tar.gz
openbsd-a50c7c74b92512423af455aa73f495ebf050f4a3.tar.bz2
openbsd-a50c7c74b92512423af455aa73f495ebf050f4a3.zip
Remove -stats option from openssl(1) errstr.
This is the only consumer of ERR_get_string_table(), which will go away. ok jsing
Diffstat (limited to 'src/usr.bin/openssl/errstr.c')
-rw-r--r--src/usr.bin/openssl/errstr.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/src/usr.bin/openssl/errstr.c b/src/usr.bin/openssl/errstr.c
index cb7cf1d5a3..d4ffd70c39 100644
--- a/src/usr.bin/openssl/errstr.c
+++ b/src/usr.bin/openssl/errstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: errstr.c,v 1.10 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: errstr.c,v 1.11 2023/07/23 11:20:11 tb 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 *
@@ -68,25 +68,14 @@
68#include <openssl/lhash.h> 68#include <openssl/lhash.h>
69#include <openssl/ssl.h> 69#include <openssl/ssl.h>
70 70
71static struct {
72 int stats;
73} cfg;
74
75static const struct option errstr_options[] = { 71static const struct option errstr_options[] = {
76 {
77 .name = "stats",
78 .desc = "Print debugging statistics for the hash table",
79 .type = OPTION_FLAG,
80 .opt.flag = &cfg.stats,
81 },
82 { NULL }, 72 { NULL },
83}; 73};
84 74
85static void 75static void
86errstr_usage() 76errstr_usage(void)
87{ 77{
88 fprintf(stderr, "usage: errstr [-stats] errno ...\n"); 78 fprintf(stderr, "usage: errstr errno ...\n");
89 options_usage(errstr_options);
90} 79}
91 80
92int 81int
@@ -103,29 +92,11 @@ errstr_main(int argc, char **argv)
103 exit(1); 92 exit(1);
104 } 93 }
105 94
106 memset(&cfg, 0, sizeof(cfg));
107
108 if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) { 95 if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) {
109 errstr_usage(); 96 errstr_usage();
110 return (1); 97 return (1);
111 } 98 }
112 99
113 if (cfg.stats) {
114 BIO *out;
115
116 if ((out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) {
117 fprintf(stderr, "Out of memory");
118 return (1);
119 }
120
121 lh_ERR_STRING_DATA_node_stats_bio(ERR_get_string_table(), out);
122 lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), out);
123 lh_ERR_STRING_DATA_node_usage_stats_bio(
124 ERR_get_string_table(), out);
125
126 BIO_free_all(out);
127 }
128
129 for (i = argsused; i < argc; i++) { 100 for (i = argsused; i < argc; i++) {
130 errno = 0; 101 errno = 0;
131 ularg = argv[i]; 102 ularg = argv[i];