From 356150aae539aac85dbb8a4073c8dbe3c8336883 Mon Sep 17 00:00:00 2001 From: bluhm <> Date: Wed, 19 Oct 2016 16:26:16 +0000 Subject: [PATCH] Remove the save_errno dance inside strerror_r(3). It is from the time when we had national language support. OK millert@ --- src/lib/libc/string/strerror_r.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/libc/string/strerror_r.c b/src/lib/libc/string/strerror_r.c index 53f5d6bd..b45dee12 100644 --- a/src/lib/libc/string/strerror_r.c +++ b/src/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 */ #include @@ -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);