Module Name:    src
Committed By:   christos
Date:           Sun Dec 30 22:50:43 UTC 2012

Modified Files:
        src/sbin/ifconfig: af_inetany.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/ifconfig/af_inetany.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/ifconfig/af_inetany.c
diff -u src/sbin/ifconfig/af_inetany.c:1.15 src/sbin/ifconfig/af_inetany.c:1.16
--- src/sbin/ifconfig/af_inetany.c:1.15	Fri Mar 16 22:25:08 2012
+++ src/sbin/ifconfig/af_inetany.c	Sun Dec 30 17:50:42 2012
@@ -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 @@ commit_address(prop_dictionary_t env, pr
 	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 @@ commit_address(prop_dictionary_t env, pr
 	/* 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)

Reply via email to