fails to build with musl libc due to use of caddr_t
ncopa opened this issue · comments
Natanael Copa commented
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
Jörg Krause commented
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.