]> git.sur5r.net Git - i3/i3status/commitdiff
print_eth_info: fix warnings on FreeBSD
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 25 Mar 2015 07:18:00 +0000 (08:18 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 25 Mar 2015 07:18:23 +0000 (08:18 +0100)
src/print_eth_info.c

index af5a75788f7cf17d4d0f3b9154781e83abc0e5d6..06a1613d62d418092b267786c687c127830c7762 100644 (file)
@@ -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 */