summaryrefslogtreecommitdiff
path: root/lib/libc/string/__strerror.c
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2001-08-24 00:11:54 +0000
committeryamt <yamt@NetBSD.org>2001-08-24 00:11:54 +0000
commite42129c827a154a4e68a5fee005b9eb553bf7b94 (patch)
treee2fd45ccab1d593337949843fe2d09c42f72cd92 /lib/libc/string/__strerror.c
parentf63829f8b02861d109228b4273622ea84f5ebb06 (diff)
don't change errno on success.(SUSV2)
this will fix error messages of some commands like setkey(8).
Diffstat (limited to 'lib/libc/string/__strerror.c')
-rw-r--r--lib/libc/string/__strerror.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/string/__strerror.c b/lib/libc/string/__strerror.c
index 59cee14a006..241df192625 100644
--- a/lib/libc/string/__strerror.c
+++ b/lib/libc/string/__strerror.c
@@ -1,4 +1,4 @@
-/* $NetBSD: __strerror.c,v 1.16 1999/09/20 04:39:43 lukem Exp $ */
+/* $NetBSD: __strerror.c,v 1.17 2001/08/24 00:11:54 yamt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -38,7 +38,7 @@
#if 0
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#else
-__RCSID("$NetBSD: __strerror.c,v 1.16 1999/09/20 04:39:43 lukem Exp $");
+__RCSID("$NetBSD: __strerror.c,v 1.17 2001/08/24 00:11:54 yamt Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -70,6 +70,7 @@ __strerror(num, buf, buflen)
unsigned int errnum;
#ifdef NLS
+ int saved_errno = errno;
nl_catd catd ;
catd = catopen("libc", 0);
#endif
@@ -95,6 +96,7 @@ __strerror(num, buf, buflen)
#ifdef NLS
catclose(catd);
+ errno = saved_errno;
#endif
return buf;