Skip to content

Commit 7fb6416

Browse files
authored
tests: fix segfault with no /etc/protocols (#286)
This file could be missing, which will cause getprotobynumber() to return NULL. The returned pointer is used to mention the protocol name in a warning message, not critical. Instead, we can simply display 'Unknown' next to the protocol ID. Fixes: d6a48d4 ("tests: Expand mptcpwrap code coverage. (#169)") Reported-by: Aurelien Jarno <[email protected]> Closes: https://bugs.debian.org/1060285 Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 863e83f commit 7fb6416

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/mptcpwrap-tester.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void test_socket_data(struct socket_data const *data)
6464
"WARNING: Ignoring unsupported "
6565
"protocol: %d - %s\n",
6666
data->protocol,
67-
p->p_name);
67+
p ? p->p_name : "Unknown");
6868

6969
return;
7070
}

0 commit comments

Comments
 (0)