Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig Set flagreq.ifr_name before issueing SIOCGIFFL...



details:   https://anonhg.NetBSD.org/src/rev/3d31c69b678f
branches:  trunk
changeset: 483916:3d31c69b678f
user:      onoe <onoe%NetBSD.org@localhost>
date:      Mon Mar 20 21:10:03 2000 +0000

description:
Set flagreq.ifr_name before issueing SIOCGIFFLAGS for setifflags.
Withoug this change, flagreq was never initialized and ifconfig w/o addr
always failed with ENXIO.

diffstat:

 sbin/ifconfig/ifconfig.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r bfd7df4e8c35 -r 3d31c69b678f sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Mon Mar 20 20:44:32 2000 +0000
+++ b/sbin/ifconfig/ifconfig.c  Mon Mar 20 21:10:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.74 2000/03/18 21:10:50 castor Exp $     */
+/*     $NetBSD: ifconfig.c,v 1.75 2000/03/20 21:10:03 onoe 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.74 2000/03/18 21:10:50 castor Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.75 2000/03/20 21:10:03 onoe Exp $");
 #endif
 #endif /* not lint */
 
@@ -830,9 +830,9 @@
        char *vname;
        int value;
 {
+       (void) strncpy(flagreq.ifr_name, name, sizeof (flagreq.ifr_name));
        if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&flagreq) < 0)
                err(1, "SIOCGIFFLAGS");
-       (void) strncpy(flagreq.ifr_name, name, sizeof (flagreq.ifr_name));
        flags = flagreq.ifr_flags;
 
        if (value < 0) {



Home | Main Index | Thread Index | Old Index