there is an error from mcast.c
cc1: warnings being treated as errors
mcast.c: In function 'if_getaddr':
mcast.c:703: warning: 'err' may be used uninitialized in this function
gmake[4]: *** [mcast.lo] Error 1
linux-ha-cvs@lists.linux-ha.org wrote:
linux-ha CVS committal
Author : alan
Host :
Project : linux-ha
Module : lib
Dir : linux-ha/lib/plugins/HBcomm
Modified Files:
mcast.c
Log Message:
Increased how long we'll wait for the network interface to get an address...
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/HBcomm/mcast.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- mcast.c 24 Feb 2006 00:14:59 -0000 1.27
+++ mcast.c 24 Feb 2006 02:20:24 -0000 1.28
@@ -1,4 +1,4 @@
-/* $Id: mcast.c,v 1.27 2006/02/24 00:14:59 alan Exp $ */
+/* $Id: mcast.c,v 1.28 2006/02/24 02:20:24 alan Exp $ */
/*
* mcast.c: implements hearbeat API for UDP multicast communication
*
@@ -696,10 +696,9 @@
static int
if_getaddr(const char *ifname, struct in_addr *addr)
{
- int fd;
struct ifreq if_info;
int j;
- int maxtry = 30;
+ int maxtry = 120;
gboolean gotaddr = FALSE;
int err;
@@ -716,28 +715,37 @@
return 0;
}
- if ((fd=socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- PILCallLog(LOG, PIL_CRIT, "Error getting socket");
- return -1;
- }
if (Debug > 0) {
PILCallLog(LOG, PIL_DEBUG, "looking up address for %s"
, if_info.ifr_name);
}
for (j=0; j < maxtry && !gotaddr; ++j) {
- if (ioctl(fd, SIOCGIFADDR, &if_info) < 0) {
- err = errno;
- sleep(1);
- }else{
+ int fd;
+ if ((fd=socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
+ PILCallLog(LOG, PIL_CRIT, "Error getting socket");
+ return -1;
+ }
+ if (ioctl(fd, SIOCGIFADDR, &if_info) >= 0) {
gotaddr = TRUE;
+ }else{
+ err = errno;
+ switch(err) {
+ case EADDRNOTAVAIL:
+ sleep(1);
+ break;
+ default:
+ close(fd);
+ goto getout;
+ }
}
+ close(fd);
}
+getout:
if (!gotaddr) {
PILCallLog(LOG, PIL_CRIT
, "Unable to retrieve local interface address"
" for interface [%s] using ioctl(SIOCGIFADDR): %s"
, ifname, strerror(err));
- close(fd);
return -1;
}
@@ -750,7 +758,6 @@
memcpy(addr, &(SOCKADDR_IN(&if_info.ifr_addr)->sin_addr)
, sizeof(struct in_addr));
- close(fd);
return 0;
}
@@ -813,6 +820,9 @@
/*
* $Log: mcast.c,v $
+ * Revision 1.28 2006/02/24 02:20:24 alan
+ * Increased how long we'll wait for the network interface to get an address...
+ *
* Revision 1.27 2006/02/24 00:14:59 alan
* Put code into mcast.c to make it retry retrieving the address from
* the interface if it fails...
_______________________________________________
Linux-ha-cvs mailing list
Linux-ha-cvs@lists.linux-ha.org
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/