Clang is complaining (`-Wsign-compare') about the comparison between
`salen' (`socklen_t', i.e., an `int' with a false moustache) and
`size_t' (`unsigned int' in this case). I can see that some warnings of
this kind are useful, but not this one. The usual arithmetic
conversions apply, so `salen' is converted to `size_t'. If it was
negative before, it's now very positive, which will trip the the
comparison and call `FAIL' -- which seems like a plausible outcome.
Muffle the warning by adding an explicit cast. This is ugly and
pointless, though: other suggestions are welcome.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
socklen_t salen=sizeof(us->addr);
int r=getsockname(us->fd,&us->addr.sa,&salen);
if (r) FAIL("getsockname()");
socklen_t salen=sizeof(us->addr);
int r=getsockname(us->fd,&us->addr.sa,&salen);
if (r) FAIL("getsockname()");
- if (salen>sizeof(us->addr)) { errno=0; FAIL("getsockname() length"); }
+ if ((size_t)salen>sizeof(us->addr)) { errno=0; FAIL("getsockname() length"); }