diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-03-01 13:51:48 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-03-01 13:51:48 +0000 |
commit | eb23a4e872f9a0d0ecc71f5b0d50babcfd73f29d (patch) | |
tree | 144a6eb0a3733344ccdd933b9697ef0439d71c77 /lib/libc/gen/setmode.c | |
parent | b889ed1331009b00b82c11cc7bc7276586bbd332 (diff) |
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.c | 6 |
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; |