xref: /freebsd/crypto/openssl/doc/man3/ERR_get_error.pod (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1=pod
2
3=head1 NAME
4
5ERR_get_error, ERR_peek_error, ERR_peek_last_error,
6ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line,
7ERR_get_error_line_data, ERR_peek_error_line_data,
8ERR_peek_last_error_line_data - obtain error code and data
9
10=head1 SYNOPSIS
11
12 #include <openssl/err.h>
13
14 unsigned long ERR_get_error(void);
15 unsigned long ERR_peek_error(void);
16 unsigned long ERR_peek_last_error(void);
17
18 unsigned long ERR_get_error_line(const char **file, int *line);
19 unsigned long ERR_peek_error_line(const char **file, int *line);
20 unsigned long ERR_peek_last_error_line(const char **file, int *line);
21
22 unsigned long ERR_get_error_line_data(const char **file, int *line,
23                                       const char **data, int *flags);
24 unsigned long ERR_peek_error_line_data(const char **file, int *line,
25                                        const char **data, int *flags);
26 unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
27                                             const char **data, int *flags);
28
29=head1 DESCRIPTION
30
31ERR_get_error() returns the earliest error code from the thread's error
32queue and removes the entry. This function can be called repeatedly
33until there are no more error codes to return.
34
35ERR_peek_error() returns the earliest error code from the thread's
36error queue without modifying it.
37
38ERR_peek_last_error() returns the latest error code from the thread's
39error queue without modifying it.
40
41See L<ERR_GET_LIB(3)> for obtaining information about
42location and reason of the error, and
43L<ERR_error_string(3)> for human-readable error
44messages.
45
46ERR_get_error_line(), ERR_peek_error_line() and
47ERR_peek_last_error_line() are the same as the above, but they
48additionally store the filename and line number where
49the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
50
51ERR_get_error_line_data(), ERR_peek_error_line_data() and
52ERR_peek_last_error_line_data() store additional data and flags
53associated with the error code in *B<data>
54and *B<flags>, unless these are B<NULL>. *B<data> contains a string
55if *B<flags>&B<ERR_TXT_STRING> is true.
56
57An application B<MUST NOT> free the *B<data> pointer (or any other pointers
58returned by these functions) with OPENSSL_free() as freeing is handled
59automatically by the error library.
60
61=head1 RETURN VALUES
62
63The error code, or 0 if there is no error in the queue.
64
65=head1 SEE ALSO
66
67L<ERR_error_string(3)>,
68L<ERR_GET_LIB(3)>
69
70=head1 COPYRIGHT
71
72Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
73
74Licensed under the OpenSSL license (the "License").  You may not use
75this file except in compliance with the License.  You can obtain a copy
76in the file LICENSE in the source distribution or at
77L<https://www.openssl.org/source/license.html>.
78
79=cut
80