Module Name: src
Committed By: roy
Date: Mon Oct 5 16:17:05 UTC 2020
Modified Files:
src/sbin/ifconfig: media.c
Log Message:
ifconfig: Warn once more if media supported but no types
This reverts media.c -r1.7
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/ifconfig/media.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/media.c
diff -u src/sbin/ifconfig/media.c:1.10 src/sbin/ifconfig/media.c:1.11
--- src/sbin/ifconfig/media.c:1.10 Tue Sep 22 14:14:17 2020
+++ src/sbin/ifconfig/media.c Mon Oct 5 16:17:05 2020
@@ -1,6 +1,6 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: media.c,v 1.10 2020/09/22 14:14:17 roy Exp $");
+__RCSID("$NetBSD: media.c,v 1.11 2020/10/05 16:17:05 roy Exp $");
#endif /* not lint */
#include <assert.h>
@@ -426,25 +426,25 @@ media_status(int media_type, int link_st
/* Interface link status is queried through SIOCGIFMEDIA.
* Not all interfaces have actual media. */
- if (ifmr.ifm_count != 0) {
- media_list = calloc(ifmr.ifm_count, sizeof(int));
- if (media_list == NULL)
- err(EXIT_FAILURE, "malloc");
- ifmr.ifm_ulist = media_list;
-
- if (prog_ioctl(s, SIOCGIFMEDIA, &ifmr) == -1)
- err(EXIT_FAILURE, "SIOCGIFMEDIA");
-
- printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
- print_media_word(ifmr.ifm_current, " ");
- if (ifmr.ifm_active != ifmr.ifm_current) {
- printf(" (");
- print_media_word(ifmr.ifm_active, " ");
- printf(")");
- }
- printf("\n");
- } else
- media_list = NULL;
+ if (ifmr.ifm_count == 0)
+ warnx("%s: no media types?", ifname);
+
+ media_list = calloc(ifmr.ifm_count, sizeof(int));
+ if (media_list == NULL)
+ err(EXIT_FAILURE, "malloc");
+ ifmr.ifm_ulist = media_list;
+
+ if (prog_ioctl(s, SIOCGIFMEDIA, &ifmr) == -1)
+ err(EXIT_FAILURE, "SIOCGIFMEDIA");
+
+ printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
+ print_media_word(ifmr.ifm_current, " ");
+ if (ifmr.ifm_active != ifmr.ifm_current) {
+ printf(" (");
+ print_media_word(ifmr.ifm_active, " ");
+ printf(")");
+ }
+ printf("\n");
if (ifmr.ifm_status & IFM_STATUS_VALID)
print_media_status(IFM_TYPE(ifmr.ifm_current), ifmr.ifm_status);