5 ERR_get_error, ERR_peek_error, ERR_get_error_line, ERR_peek_error_line,
6 ERR_get_error_line_data, ERR_peek_error_line_data - obtain error code and data
10 #include <openssl/err.h>
12 unsigned long ERR_get_error(void);
13 unsigned long ERR_peek_error(void);
15 unsigned long ERR_get_error_line(const char **file, int *line);
16 unsigned long ERR_peek_error_line(const char **file, int *line);
18 unsigned long ERR_get_error_line_data(const char **file, int *line,
19 const char **data, int *flags);
20 unsigned long ERR_peek_error_line_data(const char **file, int *line,
21 const char **data, int *flags);
25 ERR_get_error() returns the last error code from the thread's error
26 queue and removes the entry. This function can be called repeatedly
27 until there are no more error codes to return.
29 ERR_peek_error() returns the last error code from the thread's
30 error queue without modifying it.
32 See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about
33 location and reason of the error, and
34 L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error
37 ERR_get_error_line() and ERR_peek_error_line() are the same as the
38 above, but they additionally store the file name and line number where
39 the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
41 ERR_get_error_line_data() and ERR_peek_error_line_data() store
42 additional data and flags associated with the error code in *B<data>
43 and *B<flags>, unless these are B<NULL>. *B<data> contains a string
44 if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(),
45 *B<flags>&B<ERR_TXT_MALLOCED> is true.
49 The error code, or 0 if there is no error in the queue.
53 L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>,
54 L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>
58 ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and
59 ERR_peek_error_line() are available in all versions of SSLeay and
60 OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data()
61 were added in SSLeay 0.9.0.