diff options
author | jilles <jilles@FreeBSD.org> | 2011-04-05 21:56:05 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-04-05 21:56:05 +0000 |
commit | c902a38c4a1577f5b9a27832540f1a955ea78038 (patch) | |
tree | 9ba493ad554e8b08e9a294a55e6d6e571583a3e2 /lib/libc/string/strerror.c | |
parent | bb9f2459b8a1d6a5aca6101af345c3ed3ccabc83 (diff) | |
download | FreeBSD-src-c902a38c4a1577f5b9a27832540f1a955ea78038.zip FreeBSD-src-c902a38c4a1577f5b9a27832540f1a955ea78038.tar.gz |
Allow strerror(0) and strerror_r(0, ...).
Of course, strerror_r() may still fail with ERANGE.
Although the POSIX specification said this could fail with EINVAL and
doing this likely indicates invalid use of errno, most other
implementations permitted it, various POSIX testsuites require it to
work (matching the older sys_errlist array) and apparently some
applications depend on it.
PR: standards/151316
MFC after: 1 week
Diffstat (limited to 'lib/libc/string/strerror.c')
-rw-r--r-- | lib/libc/string/strerror.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 890ed21..57d253d 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -87,7 +87,7 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen) catd = catopen("libc", NL_CAT_LOCALE); #endif - if (errnum < 1 || errnum >= sys_nerr) { + if (errnum < 0 || errnum >= sys_nerr) { errstr(errnum, #if defined(NLS) catgets(catd, 1, 0xffff, UPREFIX), |