diff options
author | Jasper Lievisse Adriaanse <jasper@humppa.nl> | 2012-05-04 09:36:38 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-05-04 16:10:19 +0200 |
commit | 6b447f7f1be3e53129756b51501f469e60820334 (patch) | |
tree | 0a80f5d626aac573073bd452af0fecc093c66ded /src/print_eth_info.c | |
parent | 4d719ff81f759f3f17d66a692a83984ee6cc6fa8 (diff) |
- Remove some superfluous #ifdef clutter - If we're compiling on !(Linux or FreeBSD), just emit a '?'.
Diffstat (limited to 'src/print_eth_info.c')
-rw-r--r-- | src/print_eth_info.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/print_eth_info.c b/src/print_eth_info.c index 90005bf..941b465 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -30,13 +30,8 @@ static int print_eth_speed(char *outwalk, const char *interface) { #if defined(LINUX) - int ethspeed = 0; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - char *ethspeed; -#endif - -#if defined(LINUX) /* This code path requires root privileges */ + int ethspeed = 0; struct ifreq ifr; struct ethtool_cmd ecmd; @@ -49,6 +44,7 @@ static int print_eth_speed(char *outwalk, const char *interface) { return sprintf(outwalk, "%d Mbit/s", ethspeed); } else return sprintf(outwalk, "?"); #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + char *ethspeed; struct ifmediareq ifm; (void)memset(&ifm, 0, sizeof(ifm)); (void)strncpy(ifm.ifm_name, interface, sizeof(ifm.ifm_name)); @@ -69,6 +65,8 @@ static int print_eth_speed(char *outwalk, const char *interface) { } ethspeed = (desc->ifmt_string != NULL ? desc->ifmt_string : "?"); return sprintf(outwalk, "%s", ethspeed); +#else + return sprintf(outwalk, "?"); #endif } |