Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin clear errno before strtol() if we're going to test ...



details:   https://anonhg.NetBSD.org/src/rev/7683780f45ad
branches:  trunk
changeset: 545856:7683780f45ad
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Apr 17 02:41:21 2003 +0000

description:
clear errno before strtol() if we're going to test it for ERANGE afterwards

diffstat:

 usr.sbin/iteconfig/iteconfig.c |  5 +++--
 usr.sbin/mountd/mountd.c       |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 9b833e0713ec -r 7683780f45ad usr.sbin/iteconfig/iteconfig.c
--- a/usr.sbin/iteconfig/iteconfig.c    Thu Apr 17 01:34:14 2003 +0000
+++ b/usr.sbin/iteconfig/iteconfig.c    Thu Apr 17 02:41:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iteconfig.c,v 1.6 1997/10/17 09:54:34 lukem Exp $      */
+/*     $NetBSD: iteconfig.c,v 1.7 2003/04/17 02:41:21 lukem Exp $      */
 /*
  * Copyright (c) 1994 Christian E. Hopps
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: iteconfig.c,v 1.6 1997/10/17 09:54:34 lukem Exp $");
+__RCSID("$NetBSD: iteconfig.c,v 1.7 2003/04/17 02:41:21 lukem Exp $");
 #endif
 
 #include <sys/types.h>
@@ -207,6 +207,7 @@
 {
        long rv;
 
+       errno = 0;
        rv = strtol(s, NULL, 0);
        if (errno == ERANGE && (rv == LONG_MIN || rv == LONG_MAX))
                err(1, "bad format: \"%s\"", s);
diff -r 9b833e0713ec -r 7683780f45ad usr.sbin/mountd/mountd.c
--- a/usr.sbin/mountd/mountd.c  Thu Apr 17 01:34:14 2003 +0000
+++ b/usr.sbin/mountd/mountd.c  Thu Apr 17 02:41:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mountd.c,v 1.82 2003/01/06 12:29:52 wiz Exp $   */
+/*     $NetBSD: mountd.c,v 1.83 2003/04/17 02:41:22 lukem Exp $         */
 
 /*
  * Copyright (c) 1989, 1993
@@ -51,7 +51,7 @@
 #if 0
 static char     sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.82 2003/01/06 12:29:52 wiz Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.83 2003/04/17 02:41:22 lukem Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -2219,6 +2219,7 @@
                net->nt_len = countones(sa);
        else {
                if (opt_flags & OP_MASKLEN) {
+                       errno = 0;
                        preflen = strtol(prefp, NULL, 10);
                        if (preflen == LONG_MIN && errno == ERANGE)
                                goto fail;



Home | Main Index | Thread Index | Old Index