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