diff options
author | Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | 2014-06-22 19:36:03 +0900 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-06-22 12:26:09 -0400 |
commit | 57827c087c3d32920136842f242bf4183cbfcb35 (patch) | |
tree | f22b3fc676b64f7598de8bb03de79d2b41158263 /man/systemd-resolved.service.xml | |
parent | 026d00bc4a5f72e5541645eccf8f90761f8f1dfd (diff) |
fix in_addr_prefix_intersect for 32bits
shifting from a non fixed number of bits >= to the size of the type
leads to weird results, handle the special case of << 32 to fix it.
This was causing a test failure from test-socket-util:
Assertion 'in_addr_prefix_intersect(f, &ua, apl, &ub, bpl) == result' failed at
/var/tmp/paludis/build/sys-apps-systemd-scm/work/systemd-scm/src/test/test-socket-util.c:147, function
test_in_addr_prefix_intersect_one(). Aborting.
Minimal reproducer:
paludisbuild@Lou /tmp $ cat test.c
static void test(unsigned m) {
unsigned nm = 0xFFFFFFFFUL << (32-m);
printf("%u: %x\n", m, nm);
}
int main (void) {
test(1);
test(0);
return 0;
}
paludisbuild@Lou /tmp $ gcc -m32 -std=gnu99 test.c -o test32
paludisbuild@Lou /tmp $ ./test32
1: 80000000
0: ffffffff
paludisbuild@Lou /tmp $ gcc -std=gnu99 test.c -o test64
paludisbuild@Lou /tmp $ ./test64
1: 80000000
0: 0
Diffstat (limited to 'man/systemd-resolved.service.xml')
0 files changed, 0 insertions, 0 deletions