diff options
author | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-03-25 08:56:00 +0100 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-03-25 08:56:00 +0100 |
commit | be583ea739fd2412138c1d73a01ca4a5ca4e9252 (patch) | |
tree | ce0a76d9f000ef1cd13eadb5ae2f126174846e6a /src/print_eth_info.c | |
parent | bf223d9b61498a6b1e723bacb007545a696141fe (diff) | |
parent | c9dc67e0542a0f540b014e8b2607bfc269433951 (diff) |
Merge pull request #13 from bapt/master
Fixes for FreeBSD
Diffstat (limited to 'src/print_eth_info.c')
-rw-r--r-- | src/print_eth_info.c | 6 |
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 */ |