--- uuid_mac.c 2004/01/10 18:50:24 1.2
+++ uuid_mac.c 2004/01/10 19:17:39 1.3
@@ -30,9 +30,11 @@
#include "config.h"
#include "uuid_mac.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/param.h>
#include <time.h>
#include <sys/time.h>
#include <fcntl.h>
@@ -49,13 +51,16 @@
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_NET_IF_DL_H
#include <net/if_dl.h>
#endif
-#ifdef HAVE_IF_ARP_H
+#ifdef HAVE_NET_IF_ARP_H
#include <net/if_arp.h>
#endif
#ifdef HAVE_NETINET_IN_H
@@ -116,6 +121,7 @@
struct ifreq ifr;
struct sockaddr *sa;
int s;
+ int i;
if ((s = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
return FALSE;
@@ -139,15 +145,17 @@
struct hostent *he;
struct arpreq ar;
struct sockaddr_in *sa;
+ int s;
+ int i;
if (gethostname(hostname, sizeof(hostname)) < 0)
return FALSE;
- if ((he = gethostbyname(hostname)) < 0)
+ if ((he = gethostbyname(hostname)) == NULL)
return FALSE;
if ((s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
return FALSE;
memset(&ar, '\0', sizeof(ar));
- sa = (struct sockaddr_in *)&(ar.arp_pa);
+ sa = (struct sockaddr_in *)((void *)&(ar.arp_pa));
sa->sin_family = AF_INET;
memcpy(&(sa->sin_addr), *(he->h_addr_list), sizeof(struct in_addr));
if (ioctl(s, SIOCGARP, &ar) < 0) {
|