| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "ERR_GET_ERROR 3SSL" |
| 58 |
.TH ERR_GET_ERROR 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
ERR_get_error, ERR_peek_error, ERR_peek_last_error, |
| 65 |
ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, |
| 66 |
ERR_peek_error_func, ERR_peek_last_error_func, |
| 67 |
ERR_peek_error_data, ERR_peek_last_error_data, |
| 68 |
ERR_get_error_all, ERR_peek_error_all, ERR_peek_last_error_all, |
| 69 |
ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data |
| 70 |
\&\- obtain error code and data |
| 71 |
.SH SYNOPSIS |
| 72 |
.IX Header "SYNOPSIS" |
| 73 |
.Vb 1 |
| 74 |
\& #include <openssl/err.h> |
| 75 |
\& |
| 76 |
\& unsigned long ERR_get_error(void); |
| 77 |
\& unsigned long ERR_peek_error(void); |
| 78 |
\& unsigned long ERR_peek_last_error(void); |
| 79 |
\& |
| 80 |
\& unsigned long ERR_peek_error_line(const char **file, int *line); |
| 81 |
\& unsigned long ERR_peek_last_error_line(const char **file, int *line); |
| 82 |
\& |
| 83 |
\& unsigned long ERR_peek_error_func(const char **func); |
| 84 |
\& unsigned long ERR_peek_last_error_func(const char **func); |
| 85 |
\& |
| 86 |
\& unsigned long ERR_peek_error_data(const char **data, int *flags); |
| 87 |
\& unsigned long ERR_peek_last_error_data(const char **data, int *flags); |
| 88 |
\& |
| 89 |
\& unsigned long ERR_get_error_all(const char **file, int *line, |
| 90 |
\& const char **func, |
| 91 |
\& const char **data, int *flags); |
| 92 |
\& unsigned long ERR_peek_error_all(const char **file, int *line, |
| 93 |
\& const char **func, |
| 94 |
\& const char **data, int *flags); |
| 95 |
\& unsigned long ERR_peek_last_error_all(const char **file, int *line, |
| 96 |
\& const char *func, |
| 97 |
\& const char **data, int *flags); |
| 98 |
.Ve |
| 99 |
.PP |
| 100 |
The following functions have been deprecated since OpenSSL 3.0, and can be |
| 101 |
hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value, |
| 102 |
see \fBopenssl_user_macros\fR\|(7): |
| 103 |
.PP |
| 104 |
.Vb 7 |
| 105 |
\& unsigned long ERR_get_error_line(const char **file, int *line); |
| 106 |
\& unsigned long ERR_get_error_line_data(const char **file, int *line, |
| 107 |
\& const char **data, int *flags); |
| 108 |
\& unsigned long ERR_peek_error_line_data(const char **file, int *line, |
| 109 |
\& const char **data, int *flags); |
| 110 |
\& unsigned long ERR_peek_last_error_line_data(const char **file, int *line, |
| 111 |
\& const char **data, int *flags); |
| 112 |
.Ve |
| 113 |
.SH DESCRIPTION |
| 114 |
.IX Header "DESCRIPTION" |
| 115 |
\&\fBERR_get_error()\fR returns the earliest error code from the thread's error |
| 116 |
queue and removes the entry. This function can be called repeatedly |
| 117 |
until there are no more error codes to return. |
| 118 |
.PP |
| 119 |
\&\fBERR_peek_error()\fR returns the earliest error code from the thread's |
| 120 |
error queue without modifying it. |
| 121 |
.PP |
| 122 |
\&\fBERR_peek_last_error()\fR returns the latest error code from the thread's |
| 123 |
error queue without modifying it. |
| 124 |
.PP |
| 125 |
See \fBERR_GET_LIB\fR\|(3) for obtaining further specific information |
| 126 |
such as the reason of the error, |
| 127 |
and \fBERR_error_string\fR\|(3) for human-readable error messages. |
| 128 |
.PP |
| 129 |
\&\fBERR_get_error_all()\fR is the same as \fBERR_get_error()\fR, but on success it |
| 130 |
additionally stores the filename, line number and function where the error |
| 131 |
occurred in *\fIfile\fR, *\fIline\fR and *\fIfunc\fR, and also extra text and flags |
| 132 |
in *\fIdata\fR, *\fIflags\fR. If any of those parameters are NULL, it will not |
| 133 |
be changed. |
| 134 |
An unset filename is indicated as "", i.e. an empty string. |
| 135 |
An unset line number is indicated as 0. |
| 136 |
An unset function name is indicated as "", i.e. an empty string. |
| 137 |
.PP |
| 138 |
A pointer returned this way by these functions and the ones below |
| 139 |
is valid until the respective entry is overwritten in the error queue. |
| 140 |
.PP |
| 141 |
\&\fBERR_peek_error_line()\fR and \fBERR_peek_last_error_line()\fR are the same as |
| 142 |
\&\fBERR_peek_error()\fR and \fBERR_peek_last_error()\fR, but on success they additionally |
| 143 |
store the filename and line number where the error occurred in *\fIfile\fR and |
| 144 |
*\fIline\fR, as far as they are not NULL. |
| 145 |
An unset filename is indicated as "", i.e., an empty string. |
| 146 |
An unset line number is indicated as 0. |
| 147 |
.PP |
| 148 |
\&\fBERR_peek_error_func()\fR and \fBERR_peek_last_error_func()\fR are the same as |
| 149 |
\&\fBERR_peek_error()\fR and \fBERR_peek_last_error()\fR, but on success they additionally |
| 150 |
store the name of the function where the error occurred in *\fIfunc\fR, unless |
| 151 |
it is NULL. |
| 152 |
An unset function name is indicated as "". |
| 153 |
.PP |
| 154 |
\&\fBERR_peek_error_data()\fR and \fBERR_peek_last_error_data()\fR are the same as |
| 155 |
\&\fBERR_peek_error()\fR and \fBERR_peek_last_error()\fR, but on success they additionally |
| 156 |
store additional data and flags associated with the error code in *\fIdata\fR |
| 157 |
and *\fIflags\fR, as far as they are not NULL. |
| 158 |
Unset data is indicated as "". |
| 159 |
In this case the value given for the flag is irrelevant (and equals 0). |
| 160 |
*\fIdata\fR contains a string if *\fIflags\fR&\fBERR_TXT_STRING\fR is true. |
| 161 |
.PP |
| 162 |
\&\fBERR_peek_error_all()\fR and \fBERR_peek_last_error_all()\fR are combinations of all |
| 163 |
of the above. |
| 164 |
.PP |
| 165 |
\&\fBERR_get_error_line()\fR, \fBERR_get_error_line_data()\fR, \fBERR_peek_error_line_data()\fR |
| 166 |
and \fBERR_peek_last_error_line_data()\fR are older variants of \fBERR_get_error_all()\fR, |
| 167 |
\&\fBERR_peek_error_all()\fR and \fBERR_peek_last_error_all()\fR, and may give confusing |
| 168 |
results. They should no longer be used and are therefore deprecated. |
| 169 |
.PP |
| 170 |
An application \fBMUST NOT\fR free the *\fIdata\fR pointer (or any other pointers |
| 171 |
returned by these functions) with \fBOPENSSL_free()\fR as freeing is handled |
| 172 |
automatically by the error library. |
| 173 |
.SH "RETURN VALUES" |
| 174 |
.IX Header "RETURN VALUES" |
| 175 |
The error code, or 0 if there is no error in the queue. |
| 176 |
.SH "SEE ALSO" |
| 177 |
.IX Header "SEE ALSO" |
| 178 |
\&\fBERR_error_string\fR\|(3), |
| 179 |
\&\fBERR_GET_LIB\fR\|(3) |
| 180 |
.SH HISTORY |
| 181 |
.IX Header "HISTORY" |
| 182 |
\&\fBERR_peek_error_func()\fR, \fBERR_peek_last_error_func()\fR, |
| 183 |
\&\fBERR_peek_error_data()\fR, \fBERR_peek_last_error_data()\fR, |
| 184 |
\&\fBERR_peek_error_all()\fR and \fBERR_peek_last_error_all()\fR |
| 185 |
were added in OpenSSL 3.0. |
| 186 |
.PP |
| 187 |
\&\fBERR_get_error_line()\fR, \fBERR_get_error_line_data()\fR, \fBERR_peek_error_line_data()\fR |
| 188 |
and \fBERR_peek_last_error_line_data()\fR became deprecated in OpenSSL 3.0. |
| 189 |
.SH COPYRIGHT |
| 190 |
.IX Header "COPYRIGHT" |
| 191 |
Copyright 2000\-2022 The OpenSSL Project Authors. All Rights Reserved. |
| 192 |
.PP |
| 193 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 194 |
this file except in compliance with the License. You can obtain a copy |
| 195 |
in the file LICENSE in the source distribution or at |
| 196 |
<https://www.openssl.org/source/license.html>. |