strerror_r: enforce POSIX recommendations
POSIX recommends (but does not require) that strerror_r populate
buf even on error. But since we guarantee this behavior for
strerror, we might as well also guarantee it for strerror_r.
* lib/strerror_r.c (safe_copy): New helper method.
(strerror_r): Guarantee a non-empty string.
* tests/test-strerror_r.c (main): Enhance tests to incorporate
recent POSIX rulings and to match our strerror guarantees.
* doc/posix-functions/strerror_r.texi (strerror_r): Document this.
Signed-off-by: Eric Blake <eblake@redhat.com>