[ofa-general] {PATCH] sdpnetstat: fix compilation warnings on x86_64 machine

Dotan Barak dotanb at dev.mellanox.co.il
Sun Jan 27 05:08:30 PST 2008


Fix the following compilation warning on x86_64 machine:

interface.c:431: warning: cast from pointer to integer of different size
interface.c:438: warning: cast from pointer to integer of different size
ifconfig.c: In function `main':
ifconfig.c:463: warning: cast to pointer from integer of different size
ifconfig.c:477: warning: cast to pointer from integer of different size
hostname.c: In function `sethname':
hostname.c:104: warning: implicit declaration of function `exit'

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

Index: ofa_1_3_dev_user/src/userspace/sdpnetstat/hostname.c
===================================================================
--- ofa_1_3_dev_user.orig/src/userspace/sdpnetstat/hostname.c	2008-01-27 11:20:40.000000000 +0200
+++ ofa_1_3_dev_user/src/userspace/sdpnetstat/hostname.c	2008-01-27 14:59:34.000000000 +0200
@@ -31,6 +31,7 @@
  *              your option) any later version.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <string.h>
Index: ofa_1_3_dev_user/src/userspace/sdpnetstat/ifconfig.c
===================================================================
--- ofa_1_3_dev_user.orig/src/userspace/sdpnetstat/ifconfig.c	2008-01-27 11:20:40.000000000 +0200
+++ ofa_1_3_dev_user/src/userspace/sdpnetstat/ifconfig.c	2008-01-27 14:59:35.000000000 +0200
@@ -460,7 +460,7 @@ int main(int argc, char **argv)
 	if (!strcmp(*spp, "keepalive")) {
 	    if (*++spp == NULL)
 		usage();
-	    ifr.ifr_data = (caddr_t) atoi(*spp);
+	    ifr.ifr_data = (caddr_t)(unsigned long) atoi(*spp);
 	    if (ioctl(skfd, SIOCSKEEPALIVE, &ifr) < 0) {
 		fprintf(stderr, "SIOCSKEEPALIVE: %s\n", strerror(errno));
 		goterr = 1;
@@ -474,7 +474,7 @@ int main(int argc, char **argv)
 	if (!strcmp(*spp, "outfill")) {
 	    if (*++spp == NULL)
 		usage();
-	    ifr.ifr_data = (caddr_t) atoi(*spp);
+	    ifr.ifr_data = (caddr_t)(unsigned long) atoi(*spp);
 	    if (ioctl(skfd, SIOCSOUTFILL, &ifr) < 0) {
 		fprintf(stderr, "SIOCSOUTFILL: %s\n", strerror(errno));
 		goterr = 1;
Index: ofa_1_3_dev_user/src/userspace/sdpnetstat/lib/interface.c
===================================================================
--- ofa_1_3_dev_user.orig/src/userspace/sdpnetstat/lib/interface.c	2008-01-27 11:20:40.000000000 +0200
+++ ofa_1_3_dev_user/src/userspace/sdpnetstat/lib/interface.c	2008-01-27 14:59:45.000000000 +0200
@@ -428,14 +428,14 @@ int if_fetch(struct interface *ife)
 	if (ioctl(skfd, SIOCGOUTFILL, &ifr) < 0)
 	    ife->outfill = 0;
 	else
-	    ife->outfill = (unsigned int) ifr.ifr_data;
+	    ife->outfill = (unsigned int)(unsigned long) ifr.ifr_data;
 #endif
 #ifdef SIOCGKEEPALIVE
 	strcpy(ifr.ifr_name, ifname);
 	if (ioctl(skfd, SIOCGKEEPALIVE, &ifr) < 0)
 	    ife->keepalive = 0;
 	else
-	    ife->keepalive = (unsigned int) ifr.ifr_data;
+	    ife->keepalive = (unsigned int)(unsigned long) ifr.ifr_data;
 #endif
     }
 #endif



More information about the general mailing list