summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/setmode.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2005-03-01 13:51:47 +0000
committermiod <miod@openbsd.org>2005-03-01 13:51:47 +0000
commita5c0a3eab274a2c093597f459b228a27db3096c3 (patch)
treea897ad89084ff5c4c15f8168bcb88e84c594d9a4 /lib/libc/gen/setmode.c
parentregen (diff)
downloadwireguard-openbsd-a5c0a3eab274a2c093597f459b228a27db3096c3.tar.xz
wireguard-openbsd-a5c0a3eab274a2c093597f459b228a27db3096c3.zip
Set errno right before return(), so that it does not risk being reset
by any other functions we will invoke in-between. Fix from Andrey Matveev <andrushock@korovino.net>
Diffstat (limited to 'lib/libc/gen/setmode.c')
-rw-r--r--lib/libc/gen/setmode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 880fe192d2c..e530f09040d 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setmode.c,v 1.15 2004/07/02 13:58:06 otto Exp $ */
+/* $OpenBSD: setmode.c,v 1.16 2005/03/01 13:51:47 miod Exp $ */
/* $NetBSD: setmode.c,v 1.15 1997/02/07 22:21:06 christos Exp $ */
/*
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94";
#else
-static char rcsid[] = "$OpenBSD: setmode.c,v 1.15 2004/07/02 13:58:06 otto Exp $";
+static char rcsid[] = "$OpenBSD: setmode.c,v 1.16 2005/03/01 13:51:47 miod Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -207,8 +207,8 @@ setmode(const char *p)
perml = strtoul(p, &ep, 8);
/* The test on perml will also catch overflow. */
if (*ep != '\0' || (perml & ~(STANDARD_BITS|S_ISTXT))) {
- errno = ERANGE;
free(saveset);
+ errno = ERANGE;
return (NULL);
}
perm = (mode_t)perml;