提交 2bd61c84 编写于 作者: M Michal Privoznik

virSocketAddrIsPrivate: Work on 32bits platforms

Yet another one of those where signed int (or long int) is not
enough. And useless to as we're aiming at unsigned anyway.

../../src/util/virsocketaddr.c: In function 'virSocketAddrIsPrivate':
../../src/util/virsocketaddr.c:289:45: error: result of '192l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
        return ((val & 0xFFFF0000) == ((192L << 24) + (168 << 16)) ||
                                             ^~
../../src/util/virsocketaddr.c:290:45: error: result of '172l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
                (val & 0xFFF00000) == ((172L << 24) + (16  << 16)) ||
                                             ^~
cc1: all warnings being treated as errors
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 3864d863
......@@ -286,9 +286,9 @@ virSocketAddrIsPrivate(const virSocketAddr *addr)
case AF_INET:
val = ntohl(addr->data.inet4.sin_addr.s_addr);
return ((val & 0xFFFF0000) == ((192L << 24) + (168 << 16)) ||
(val & 0xFFF00000) == ((172L << 24) + (16 << 16)) ||
(val & 0xFF000000) == ((10L << 24)));
return ((val & 0xFFFF0000) == ((192UL << 24) + (168 << 16)) ||
(val & 0xFFF00000) == ((172UL << 24) + (16 << 16)) ||
(val & 0xFF000000) == ((10UL << 24)));
case AF_INET6:
return ((addr->data.inet6.sin6_addr.s6_addr[0] & 0xFE) == 0xFC ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册