Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig PR/46579: Takahiro HAYASHI: ifconfig clone des...



details:   https://anonhg.NetBSD.org/src/rev/c8b4750c0aed
branches:  trunk
changeset: 783587:c8b4750c0aed
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Dec 30 22:50:42 2012 +0000

description:
PR/46579: Takahiro HAYASHI: ifconfig clone destroy should not print useless
diagnostic and exit with an error code. Get the interface name and flags
opportunistically to allow the code to return normally if it does not need
to do anything.

diffstat:

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

diffs (37 lines):

diff -r 35f143d7c541 -r c8b4750c0aed sbin/ifconfig/af_inetany.c
--- a/sbin/ifconfig/af_inetany.c        Sun Dec 30 21:23:20 2012 +0000
+++ b/sbin/ifconfig/af_inetany.c        Sun Dec 30 22:50:42 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_inetany.c,v 1.15 2012/03/17 02:25:08 christos Exp $ */
+/*     $NetBSD: af_inetany.c,v 1.16 2012/12/30 22:50:42 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_inetany.c,v 1.15 2012/03/17 02:25:08 christos Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.16 2012/12/30 22:50:42 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -80,7 +80,7 @@
        if ((s = getsock(af)) == -1)
                err(EXIT_FAILURE, "%s: getsock", __func__);
 
-       if ((ifname = getifinfo(env, oenv, &flags)) == NULL)
+       if ((ifname = getifname(env)) == NULL)
                err(EXIT_FAILURE, "%s: getifinfo", __func__);
 
        strlcpy(param->name[0].buf, ifname, param->name[0].buflen);
@@ -126,6 +126,9 @@
        /* TBD: read matching ifaddr from kernel, use the netmask as default
         * TBD: handle preference
         */
+       if (getifflags(env, oenv, &flags) == -1)
+               err(EXIT_FAILURE, "%s: getifflags", __func__);
+
        switch (flags & (IFF_BROADCAST|IFF_POINTOPOINT)) {
        case IFF_BROADCAST:
                if (brd != NULL)



Home | Main Index | Thread Index | Old Index