qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leticia <reyt...@gmail.com>
Subject Installing broker on Ubuntu - Strict aliasing problem
Date Mon, 16 Nov 2009 12:26:23 GMT
Hello there!

I have a problem doing the make all part of the installation process of qpid
broker. It looks exactly  like this:

qpid/sys/posix/SystemInfo.cpp: In function 'void qpid::sys::SystemInfo::
getLocalIpAddresses(uint16_t, std::vector<qpid::Address,
std::allocator<qpid::Address> >&)':
qpid/sys/posix/SystemInfo.cpp:73: error: dereferencing pointer 'sin' does
break strict-aliasing rules
qpid/sys/posix/SystemInfo.cpp:72: note: initialized from here

And the code lines correspond to these ones:

void SystemInfo::getLocalIpAddresses (uint16_t port, std::vector<Address>
&addrList) {
    int s = socket (PF_INET, SOCK_STREAM, 0);
    for (int i=1;;i++) {
        struct ifreq ifr;
        ifr.ifr_ifindex = i;
        if (::ioctl (s, SIOCGIFNAME, &ifr) < 0)
            break;
        /* now ifr.ifr_name is set */
        if (::ioctl (s, SIOCGIFADDR, &ifr) < 0)
            continue;
        struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
/*Line 72*/
        string addr(inet_ntoa(sin->sin_addr)); /*Line 73 breaking rules! */
        if (addr != LOCALHOST)
            addrList.push_back(TcpAddress(addr, port));
    }
    if (addrList.empty()) {
        addrList.push_back(TcpAddress(LOCALHOST, port));
    }
    close (s);
}


I'm using the latest Ubuntu version and gcc 4.4 and I'd like to solve this
problem without going back to the previous version of the compiler.

Could you please help me?

Thanks a lot!

Reytita

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message