summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-03-25 08:18:00 +0100
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-03-25 08:18:23 +0100
commit0b882f36b55a0e45506d33d60e343ec9a492fbb4 (patch)
tree7a2c49b519ee0428e2ee19a44d9c768f06340304
parenteaf5d6bf801baa6169d388b910a75f8108499239 (diff)
print_eth_info: fix warnings on FreeBSD
-rw-r--r--src/print_eth_info.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/print_eth_info.c b/src/print_eth_info.c
index af5a757..06a1613 100644
--- a/src/print_eth_info.c
+++ b/src/print_eth_info.c
@@ -49,11 +49,13 @@ static int print_eth_speed(char *outwalk, const char *interface) {
} else
return sprintf(outwalk, "?");
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
- char *ethspeed;
+ const char *ethspeed;
struct ifmediareq ifm;
(void)memset(&ifm, 0, sizeof(ifm));
(void)strncpy(ifm.ifm_name, interface, sizeof(ifm.ifm_name));
- int ret = ioctl(general_socket, SIOCGIFMEDIA, (caddr_t)&ifm);
+ if (ioctl(general_socket, SIOCGIFMEDIA, (caddr_t)&ifm) < 0) {
+ return sprintf(outwalk, "?");
+ }
/* Get the description of the media type, partially taken from
* FreeBSD's ifconfig */