This will make it behave more like the bsd/solaris versions
-Angus
Index: exec/totemip.c
===================================================================
--- exec/totemip.c (revision 2367)
+++ exec/totemip.c (working copy)
@@ -471,6 +471,7 @@
int mask_high_bit)
{
int fd;
+ int res = -1;
struct {
struct nlmsghdr nlh;
struct rtgenmsg g;
@@ -588,17 +589,28 @@
/* SIOCGIFFLAGS needs an interface name
*/
status = ioctl(ioctl_fd, SIOCGIFNAME,
&ifr);
status = ioctl(ioctl_fd, SIOCGIFFLAGS,
&ifr);
+ close(ioctl_fd);
if (status) {
- close(ioctl_fd);
- close(fd);
- return -1;
+ res = -1;
+ goto finished;
}
if (ifr.ifr_flags & IFF_UP)
*interface_up = 1;
*interface_num = ifa->ifa_index;
- close(ioctl_fd);
+ /* Mask 32nd bit off to workaround bugs
in other peoples code
+ * (if configuration requests it). */
+ if (ipaddr.family == AF_INET &&
ipaddr.nodeid == 0) {
+ unsigned int nodeid = 0;
+ memcpy (&nodeid, ipaddr.addr,
sizeof (int));
+ if (mask_high_bit) {
+ nodeid &= 0x7FFFFFFF;
+ }
+ ipaddr.nodeid = nodeid;
+ }
+ totemip_copy (boundto, &ipaddr);
+ res = 0;
goto finished;
}
}
@@ -606,21 +618,9 @@
h = NLMSG_NEXT(h, status);
}
}
+ res = -1; /* address not found */
finished:
- /*
- * Mask 32nd bit off to workaround bugs in other poeples code
- * if configuration requests it.
- */
- if (ipaddr.family == AF_INET && ipaddr.nodeid == 0) {
- unsigned int nodeid = 0;
- memcpy (&nodeid, ipaddr.addr, sizeof (int));
- if (mask_high_bit) {
- nodeid &= 0x7FFFFFFF;
- }
- ipaddr.nodeid = nodeid;
- }
- totemip_copy (boundto, &ipaddr);
close(fd);
- return 0;
+ return res;
}
#endif /* COROSYNC_LINUX */
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais