alobbs / macchanger

GNU MAC Changer
http://www.gnu.org/software/macchanger
GNU General Public License v3.0
575 stars 112 forks source link

fails to build with musl libc due to use of caddr_t #14

Open ncopa opened 9 years ago

ncopa commented 9 years ago

When trying to build on alpine linux with musl libc i get:

netinfo.c: In function 'mc_net_info_get_permanent_mac':
netinfo.c:116:28: error: 'caddr_t' undeclared (first use in this function)
  req.ifr_data = (caddr_t)epa;
                            ^

This fixes it:

--- ./src/netinfo.c.orig
+++ ./src/netinfo.c
@@ -113,7 +113,7 @@
        epa->size = IFHWADDRLEN;

        memcpy(&req, &(net->dev), sizeof(struct ifreq));
-       req.ifr_data = (caddr_t)epa;
+       req.ifr_data = (void *)epa;

        if (ioctl(net->sock, SIOCETHTOOL, &req) < 0) {
                perror ("[ERROR] Could not read permanent MAC");

for details see: http://stackoverflow.com/questions/6381526/what-is-the-significance-of-caddr-t-and-when-is-it-used

joerg-krause commented 8 years ago

I know the project is probably dead. However, I want to clarify that musl defines caddr_t in <sys/types.h>. So to fix it this header file has to be included to fix build with the musl C library.