diff options
author | bluhm <> | 2016-10-19 16:26:16 +0000 |
---|---|---|
committer | bluhm <> | 2016-10-19 16:26:16 +0000 |
commit | ac7c37977891b32e21ccb19829cc10dc20c3d5ca (patch) | |
tree | 18cdb4ba9de455c39d90013ca8afb3139268e531 | |
parent | e136d75872f02f48d5744f8e936b2ed07c641e9d (diff) | |
download | openbsd-ac7c37977891b32e21ccb19829cc10dc20c3d5ca.tar.gz openbsd-ac7c37977891b32e21ccb19829cc10dc20c3d5ca.tar.bz2 openbsd-ac7c37977891b32e21ccb19829cc10dc20c3d5ca.zip |
Remove the save_errno dance inside strerror_r(3). It is from the
time when we had national language support.
OK millert@
-rw-r--r-- | src/lib/libc/string/strerror_r.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libc/string/strerror_r.c b/src/lib/libc/string/strerror_r.c index 53f5d6bda4..b45dee12d8 100644 --- a/src/lib/libc/string/strerror_r.c +++ b/src/lib/libc/string/strerror_r.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strerror_r.c,v 1.12 2015/10/25 10:22:09 bluhm Exp $ */ | 1 | /* $OpenBSD: strerror_r.c,v 1.13 2016/10/19 16:26:16 bluhm Exp $ */ |
2 | /* Public Domain <marc@snafu.org> */ | 2 | /* Public Domain <marc@snafu.org> */ |
3 | 3 | ||
4 | #include <errno.h> | 4 | #include <errno.h> |
@@ -85,15 +85,13 @@ __num2string(int num, int sign, int setid, char *buf, size_t buflen, | |||
85 | int | 85 | int |
86 | strerror_r(int errnum, char *strerrbuf, size_t buflen) | 86 | strerror_r(int errnum, char *strerrbuf, size_t buflen) |
87 | { | 87 | { |
88 | int save_errno; | ||
89 | int ret_errno; | 88 | int ret_errno; |
90 | 89 | ||
91 | save_errno = errno; | ||
92 | |||
93 | ret_errno = __num2string(errnum, 1, 1, strerrbuf, buflen, | 90 | ret_errno = __num2string(errnum, 1, 1, strerrbuf, buflen, |
94 | sys_errlist, sys_nerr, UPREFIX); | 91 | sys_errlist, sys_nerr, UPREFIX); |
95 | 92 | ||
96 | errno = ret_errno ? ret_errno : save_errno; | 93 | if (ret_errno) |
94 | errno = ret_errno; | ||
97 | return (ret_errno); | 95 | return (ret_errno); |
98 | } | 96 | } |
99 | DEF_WEAK(strerror_r); | 97 | DEF_WEAK(strerror_r); |