Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig init variable before strtoul



details:   https://anonhg.NetBSD.org/src/rev/13cdf9d28851
branches:  trunk
changeset: 532741:13cdf9d28851
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jun 14 01:07:00 2002 +0000

description:
init variable before strtoul

diffstat:

 sbin/ifconfig/ifconfig.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 897d541d2688 -r 13cdf9d28851 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Fri Jun 14 01:06:51 2002 +0000
+++ b/sbin/ifconfig/ifconfig.c  Fri Jun 14 01:07:00 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.125 2002/06/14 01:04:41 itojun Exp $    */
+/*     $NetBSD: ifconfig.c,v 1.126 2002/06/14 01:07:01 itojun Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 #if 0
 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
 #else
-__RCSID("$NetBSD: ifconfig.c,v 1.125 2002/06/14 01:04:41 itojun Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.126 2002/06/14 01:07:01 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -1225,10 +1225,9 @@
        const char *val;
        int d;
 {
-       char *ep;
+       char *ep = NULL;
 
        (void) strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
-       ep = NULL;
        ifr.ifr_metric = strtoul(val, &ep, 10);
        if (!ep || *ep)
                errx(1, "%s: invalid metric", val);
@@ -1241,7 +1240,7 @@
        const char *val;
        int d;
 {
-       char *ep;
+       char *ep = NULL;
 
        (void)strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
        ifr.ifr_mtu = strtoul(val, &ep, 10);



Home | Main Index | Thread Index | Old Index