diff options
author | 2016-10-19 16:26:16 +0000 | |
---|---|---|
committer | 2016-10-19 16:26:16 +0000 | |
commit | 3a9dd5c3476b66d67674a94ff403050abfa7df18 (patch) | |
tree | d503902609e4dbca3f2091d6d3e59a7a8ded92bd /lib/libc/string/strerror_r.c | |
parent | Use the reentrant strerror_r() instead of strerror() to expand %m. (diff) | |
download | wireguard-openbsd-3a9dd5c3476b66d67674a94ff403050abfa7df18.tar.xz wireguard-openbsd-3a9dd5c3476b66d67674a94ff403050abfa7df18.zip |
Remove the save_errno dance inside strerror_r(3). It is from the
time when we had national language support.
OK millert@
Diffstat (limited to 'lib/libc/string/strerror_r.c')
-rw-r--r-- | lib/libc/string/strerror_r.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/string/strerror_r.c b/lib/libc/string/strerror_r.c index 53f5d6bda40..b45dee12d8a 100644 --- a/lib/libc/string/strerror_r.c +++ b/lib/libc/string/strerror_r.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror_r.c,v 1.12 2015/10/25 10:22:09 bluhm Exp $ */ +/* $OpenBSD: strerror_r.c,v 1.13 2016/10/19 16:26:16 bluhm Exp $ */ /* Public Domain <marc@snafu.org> */ #include <errno.h> @@ -85,15 +85,13 @@ __num2string(int num, int sign, int setid, char *buf, size_t buflen, int strerror_r(int errnum, char *strerrbuf, size_t buflen) { - int save_errno; int ret_errno; - save_errno = errno; - ret_errno = __num2string(errnum, 1, 1, strerrbuf, buflen, sys_errlist, sys_nerr, UPREFIX); - errno = ret_errno ? ret_errno : save_errno; + if (ret_errno) + errno = ret_errno; return (ret_errno); } DEF_WEAK(strerror_r); |