Skip to content

Commit 6c43bc7

Browse files
committed
Fix wrong comparison
We compare the listen() function pointer to 0 instead of the listen_fd. This "works" because it is an extension. Using -Wall -Wextra -pedantic reveals the error: main.c:456:14: warning: ordered comparison between pointer and zero ('int (*)(int, int)' and 'int') is an extension [-Wpedantic] 456 | if (listen >= 0) { | ~~~~~~ ^ ~ Fix to compare listen_fd, and use -1 since this is is the sentinel value meaning we failed to create the socket. Signed-off-by: Nir Soffer <[email protected]>
1 parent d83ccf0 commit 6c43bc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ int main(int argc, char *argv[]) {
453453
if (iface != NULL) {
454454
stop(&state, iface);
455455
}
456-
if (listen >= 0) {
456+
if (listen_fd != -1) {
457457
close(listen_fd);
458458
}
459459
if (pid_fd != -1) {

0 commit comments

Comments
 (0)