Fix compiler warning in IPv6 check

(This was why I saw a warning from the IPv4 code path, now fixed by 7949e4c).
Check return values from some syscalls and warn if they fail