diff options
author | wes <wes@FreeBSD.org> | 2001-12-07 06:28:58 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 2001-12-07 06:28:58 +0000 |
commit | fc6e3f432826fe9d9a9d2d05e295a7c7d11d259e (patch) | |
tree | 13ab748ad6a3bd42035b82a51f7ead77dbbf376b /lib/libc/string/strerror.3 | |
parent | 9aa8f2242aaf9263e01dbd9fb9be9cd2d1a14c2b (diff) | |
download | FreeBSD-src-fc6e3f432826fe9d9a9d2d05e295a7c7d11d259e.zip FreeBSD-src-fc6e3f432826fe9d9a9d2d05e295a7c7d11d259e.tar.gz |
Make strerror and strerror_r use sys_errlist[0] for errnum = 0. Be
more careful about reporting truncation with ERANGE in strerror_r.
Set errno to EINVAL for "unknown" errnum in strerror as required
by P1003.1-200x Draft June 14, 2001.
More carefully document the handling of strerrbuf when errors
(ERANGE, EINVAL) are encountered in strerror_r.
Reviewed by: bde (ongoing discussion)
Diffstat (limited to 'lib/libc/string/strerror.3')
-rw-r--r-- | lib/libc/string/strerror.3 | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3 index 037b138..2ed92d6 100644 --- a/lib/libc/string/strerror.3 +++ b/lib/libc/string/strerror.3 @@ -110,8 +110,15 @@ returns an error message string containing .Dq Li "Unknown error:\ " followed by the error number in decimal, while .Fn strerror_r -returns +leaves +.Fa strerrbuf +unchanged and returns .Er EINVAL . +Error numbers recognized by this implementation fall in +the range 0 <= +.Fa errnum +< +.Fa sys_nerr . .Pp If insufficient storage is provided in .Fa strerrbuf @@ -121,9 +128,11 @@ to contain the error string, .Fn strerror_r returns .Er ERANGE -and the contents of +and .Fa strerrbuf -are indeterminate. +will contain an error message that has been truncated and nul +terminated to fit the length specified by +.Fa buflen . .Pp The message strings can be accessed directly using the external array |