On Wed, Oct 19, 2016 at 09:34:16AM -0600, Theo de Raadt wrote:
> Inside strerror_r, I'm unsure why there is a save_errno dance.

That is from the time when we had national language support.

ok?

bluhm

Index: lib/libc/string/strerror_r.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/lib/libc/string/strerror_r.c,v
retrieving revision 1.12
diff -u -p -r1.12 strerror_r.c
--- lib/libc/string/strerror_r.c        25 Oct 2015 10:22:09 -0000      1.12
+++ lib/libc/string/strerror_r.c        19 Oct 2016 15:57:45 -0000
@@ -85,15 +85,13 @@ __num2string(int num, int sign, int seti
 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);

Reply via email to