mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
BUILD: sockpair: silence a build warning at -Wextra
An invalid null-deref warning is emitted because cmsg is not checked, though it definitely is valid given the test performed 10 lines above, but the compiler cannot necessarily guess this. Adding a null test to the problematic condition is enough to get rid of it and cheap enough.
This commit is contained in:
parent
1e582e5e5c
commit
7d7ab43a33
1 changed files with 1 additions and 1 deletions
|
|
@ -382,7 +382,7 @@ int recv_fd_uxst(int sock)
|
|||
return ret;
|
||||
|
||||
cmsg = CMSG_FIRSTHDR(&msghdr);
|
||||
if (cmsg->cmsg_level == SOL_SOCKET &&
|
||||
if (cmsg && cmsg->cmsg_level == SOL_SOCKET &&
|
||||
cmsg->cmsg_type == SCM_RIGHTS) {
|
||||
size_t totlen = cmsg->cmsg_len -
|
||||
CMSG_LEN(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue