From 98abed1abd937bf8f858f930f77050f54dfccf7b Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Tue, 22 Nov 2011 13:37:23 +0100 Subject: [PATCH] fixed compiler warnings on Mac OS X 64bit --- CHANGES | 3 +++ filan.c | 7 +++++-- hostan.c | 6 ++++-- xio-ip.c | 2 ++ xio-socket.c | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index f2ad794..790f2b3 100644 --- a/CHANGES +++ b/CHANGES @@ -75,6 +75,9 @@ porting: Lion 7.1); thanks to Jerry Jacobs to reporting this problem and proposing a solution + fixed compiler warnings on Mac OS X 64bit. Thanks to Guy Harris for + providing the patch. + ####################### V 1.7.1.3: security: diff --git a/filan.c b/filan.c index 6461e47..a9cdcb3 100644 --- a/filan.c +++ b/filan.c @@ -1,5 +1,5 @@ /* source: filan.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* the subroutine filan makes a "FILe descriptor ANalysis". It checks the @@ -490,7 +490,10 @@ int cdevan(int fd, FILE *outfile) { return -1; } fprintf(outfile, " \tIFLAGS=%08x OFLAGS=%08x CFLAGS=%08x LFLAGS=%08x", - termarg.c_iflag, termarg.c_oflag, termarg.c_cflag, termarg.c_lflag); + (unsigned int)termarg.c_iflag, + (unsigned int)termarg.c_oflag, + (unsigned int)termarg.c_cflag, + (unsigned int)termarg.c_lflag); /* and the control characters */ if (filan_rawoutput) { diff --git a/hostan.c b/hostan.c index 9977914..03e08fc 100644 --- a/hostan.c +++ b/hostan.c @@ -1,5 +1,5 @@ /* source: hostan.c */ -/* Copyright Gerhard Rieger 2006-2008 */ +/* Copyright Gerhard Rieger 2006-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* the subroutine hostan makes a "HOST ANalysis". It gathers information @@ -59,7 +59,9 @@ static int iffan(FILE *outfile) { for (i = 0; i < ic.ifc_len; i += sizeof(struct ifreq)) { struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i); +#if 0 || defined(SIOCGIFINDEX) /* not NetBSD, OpenBSD */ struct ifreq ifr; +#endif #if 0 || defined(SIOCGIFINDEX) /* not NetBSD, OpenBSD */ strcpy(ifr.ifr_name, ifp->ifr_name); @@ -74,7 +76,7 @@ static int iffan(FILE *outfile) { fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_name); #endif /* HAVE_STRUCT_IFREQ_IFR_INDEX */ #else /* !defined(SIOCGIFINDEX) */ - fprintf(outfile, "%2d: %s\n", i/sizeof(struct ifreq), ifp->ifr_name); + fprintf(outfile, "%2d: %s\n", i/(int)sizeof(struct ifreq), ifp->ifr_name); #endif /* defined(SIOCGIFINDEX) */ } Close(s); diff --git a/xio-ip.c b/xio-ip.c index dad647d..4e125e7 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -454,8 +454,10 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num, const char *cmsgtype, *cmsgname = NULL, *cmsgenvn = NULL, *cmsgfmt = NULL; size_t msglen; char scratch1[16]; /* can hold an IPv4 address in ASCII */ +#if WITH_IP4 && defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO char scratch2[16]; char scratch3[16]; +#endif msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg); envbuff[0] = '\0'; diff --git a/xio-socket.c b/xio-socket.c index 3829e81..cc18a3c 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -1,5 +1,5 @@ /* source: xio-socket.c */ -/* Copyright Gerhard Rieger 2001-2009 */ +/* Copyright Gerhard Rieger 2001-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for socket related functions, and the @@ -1846,7 +1846,7 @@ xiolog_ancillary_socket(struct cmsghdr *cmsg, int *num, cmsgname = "timestamp"; cmsgenvn = "TIMESTAMP"; { time_t t = tv->tv_sec; ctime_r(&t, valbuff); } - sprintf(strchr(valbuff, '\0')-1/*del \n*/, ", %06ld usecs", tv->tv_usec); + sprintf(strchr(valbuff, '\0')-1/*del \n*/, ", %06ld usecs", (long)tv->tv_usec); break; #endif /* defined(SO_TIMESTAMP) */ ;