blob: 695eaf20f02e751446f3a9dfea97aa47451de485 [file] [log] [blame]
Ulf Möller388f2f52000-02-01 01:37:00 +00001=pod
2
3=head1 NAME
4
Richard Levittee1b78bc2000-09-14 21:23:28 +00005ERR_error_string, ERR_error_string_n, ERR_lib_error_string,
6ERR_func_error_string, ERR_reason_error_string - obtain human-readable
7error message
Ulf Möller388f2f52000-02-01 01:37:00 +00008
9=head1 SYNOPSIS
10
11 #include <openssl/err.h>
12
13 char *ERR_error_string(unsigned long e, char *buf);
Dr. Stephen Henson4451c252004-11-14 15:11:37 +000014 void ERR_error_string_n(unsigned long e, char *buf, size_t len);
Ulf Möller388f2f52000-02-01 01:37:00 +000015
16 const char *ERR_lib_error_string(unsigned long e);
17 const char *ERR_func_error_string(unsigned long e);
18 const char *ERR_reason_error_string(unsigned long e);
19
20=head1 DESCRIPTION
21
22ERR_error_string() generates a human-readable string representing the
Rich Salza0474352016-02-01 15:15:06 -050023error code I<e>, and places it at I<buf>. I<buf> must be at least 256
Bodo Möllere5c84d52000-04-14 23:36:15 +000024bytes long. If I<buf> is B<NULL>, the error string is placed in a
Ulf Möller388f2f52000-02-01 01:37:00 +000025static buffer.
Rich Salza0474352016-02-01 15:15:06 -050026Note that this function is not thread-safe and does no checks on the size
27of the buffer; use ERR_error_string_n() instead.
28
Bodo Möllere5c84d52000-04-14 23:36:15 +000029ERR_error_string_n() is a variant of ERR_error_string() that writes
30at most I<len> characters (including the terminating 0)
Bodo Möller2c8c4ce2000-04-15 00:04:30 +000031and truncates the string if necessary.
Bodo Möllere5c84d52000-04-14 23:36:15 +000032For ERR_error_string_n(), I<buf> may not be B<NULL>.
Ulf Möller388f2f52000-02-01 01:37:00 +000033
34The string will have the following format:
35
36 error:[error code]:[library name]:[function name]:[reason string]
37
38I<error code> is an 8 digit hexadecimal number, I<library name>,
39I<function name> and I<reason string> are ASCII text.
40
41ERR_lib_error_string(), ERR_func_error_string() and
42ERR_reason_error_string() return the library name, function
43name and reason string respectively.
44
Ulf Möller388f2f52000-02-01 01:37:00 +000045If there is no text string registered for the given error code,
46the error string will contain the numeric code.
47
Rich Salz9b869742015-08-17 15:21:33 -040048L<ERR_print_errors(3)> can be used to print
Ulf Möller388f2f52000-02-01 01:37:00 +000049all error codes currently in the queue.
50
51=head1 RETURN VALUES
52
53ERR_error_string() returns a pointer to a static buffer containing the
Bodo Möllere5c84d52000-04-14 23:36:15 +000054string if I<buf> B<== NULL>, I<buf> otherwise.
Ulf Möller388f2f52000-02-01 01:37:00 +000055
56ERR_lib_error_string(), ERR_func_error_string() and
57ERR_reason_error_string() return the strings, and B<NULL> if
58none is registered for the error code.
59
60=head1 SEE ALSO
61
Rich Salz73fb82b2017-03-02 10:07:21 -050062L<ERR_get_error(3)>,
Rich Salz9b869742015-08-17 15:21:33 -040063L<ERR_print_errors(3)>
Ulf Möller388f2f52000-02-01 01:37:00 +000064
Rich Salze2f92612016-05-18 11:44:05 -040065=head1 COPYRIGHT
66
Rich Salz73fb82b2017-03-02 10:07:21 -050067Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
Rich Salze2f92612016-05-18 11:44:05 -040068
69Licensed under the OpenSSL license (the "License"). You may not use
70this file except in compliance with the License. You can obtain a copy
71in the file LICENSE in the source distribution or at
72L<https://www.openssl.org/source/license.html>.
73
74=cut