Merge branch 'selftests-net-fixes-for-fin_ack_lat'

Qingshuang Fu says:

====================
selftests/net: fixes for fin_ack_lat

This series fixes two bugs in the fin_ack_lat self-test.

Patch 1 fixes the swapped kill() arguments in sig_handler(), so the
server actually forwards SIGTERM to the client.  It also makes the
wrapper script's cleanup tolerant of ESRCH, since the client may now
exit before the kill command reaches its PID.

Patch 2 adds a missing fork() error check: on failure the code falls
into server()'s infinite accept loop, producing empty output that the
wrapper script treats as a passing test.
====================

Link: https://patch.msgid.link/20260821030922.1123754-1-fffsqian@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2026-08-24 11:40:32 -07:00
2 changed files with 5 additions and 2 deletions

View File

@@ -103,7 +103,8 @@ static void server(int sock, struct sockaddr_in address)
static void sig_handler(int signum)
{
kill(SIGTERM, child_pid);
if (child_pid > 0)
kill(child_pid, SIGTERM);
exit(0);
}
@@ -142,6 +143,8 @@ int main(int argc, char const *argv[])
fprintf(stderr, "server port: %d\n", ntohs(laddr.sin_port));
child_pid = fork();
if (child_pid < 0)
error(-1, errno, "fork");
if (!child_pid)
client(ntohs(laddr.sin_port));
else

View File

@@ -9,7 +9,7 @@ set -e
tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
cleanup() {
kill $(pidof fin_ack_lat)
kill $(pidof fin_ack_lat) 2>/dev/null || true
rm -f $tmpfile
}