Commit 23d3c1a2676b1aa6cb1388891485de846d7435d8

Eric Blake 2011-06-21T10:00:55

strerror_r: fix OpenBSD behavior on out-of-range On OpenBSD, strerror_r(1000,buf,19) gives "Unknown error: " rather than "Unknown error: 100" while failing with ERANGE. Admittedly, this behavior is nice, since a truncated integer is misleading, but all other platforms use maximal strings on ERANGE and we are already replacing strerror_r for other reasons, so it is easier to work around this behavior than to adjust the testsuite (how do you quickly decide if the only reason that the ERANGE string was shorter than maximal was because the implementation avoided truncating an integer?). This patch intentionally avoids dragging in the strnlen module. * lib/strerror_r.c (strerror_r): Always use maximal string. * doc/posix-functions/strerror_r.texi (strerror_r): Document it. Signed-off-by: Eric Blake <eblake@redhat.com>