Commits

William Giokas committed 6be28e7

Fix ip address printing

Credit goes to numeral for this one.

Comments (0)

Files changed (2)

  * systemd has some new naming conventions you can turn on with longer names.
  */
 #define NET_DEVICE_PRIMARY "wlp3s0"
-/* Currently not of any use */
 #define NET_DEVICE_SECONDARY "enp0s25"
 
 /* Specity path to your battery */

include/network.h

 char *
 get_ip_addr(const char *interface)
 {
-    static char part[100];
+    static char part[64];
+    char *retstr = (char *) malloc(64);
     socklen_t len = sizeof(struct sockaddr_in);
     memset(part, 0, sizeof(part));
     struct ifaddrs *ifaddr, *addrp;
             return NULL;
         }
     freeifaddrs(ifaddr);
-    return part;
+    strncpy(retstr, part, 64);
+    return retstr;
 }