In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable might be used uninitialized. This is a false positive because the only code path that could lead to uninitialized access is where getaddrinfo() fails, but the local xgetaddrinfo() wrapper exits if such a failure occurs. Initialize the 'sock' variable anyway to allow the tools to build with gcc 12.
Unified · Split
| @@ -265,7 +265,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line) · 264 unmodified lines | ||
| 265 | 265 | static int sock_listen_mptcp(const char * const listenaddr, |
| 266 | 266 | const char * const port) |
| 267 | 267 | { |
| 268 | − int sock; | |
| 268 | + int sock = -1; | |
| 269 | 269 | struct addrinfo hints = { |
| 270 | 270 | .ai_protocol = IPPROTO_TCP, |
| 271 | 271 | .ai_socktype = SOCK_STREAM, |
| @@ -88,7 +88,7 @@ static void xgetaddrinfo(const char *node, const char *service, · 87 unmodified lines | ||
| 88 | 88 | static int sock_listen_mptcp(const char * const listenaddr, |
| 89 | 89 | const char * const port) |
| 90 | 90 | { |
| 91 | − int sock; | |
| 91 | + int sock = -1; | |
| 92 | 92 | struct addrinfo hints = { |
| 93 | 93 | .ai_protocol = IPPROTO_TCP, |
| 94 | 94 | .ai_socktype = SOCK_STREAM, |
| @@ -136,7 +136,7 @@ static void xgetaddrinfo(const char *node, const char *service, · 135 unmodified lines | ||
| 136 | 136 | static int sock_listen_mptcp(const char * const listenaddr, |
| 137 | 137 | const char * const port) |
| 138 | 138 | { |
| 139 | − int sock; | |
| 139 | + int sock = -1; | |
| 140 | 140 | struct addrinfo hints = { |
| 141 | 141 | .ai_protocol = IPPROTO_TCP, |
| 142 | 142 | .ai_socktype = SOCK_STREAM, |