From 4cfa9edb35736ddf4efd2bd8ccc885349dc69b8e Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sun, 2 Oct 2022 20:18:00 +0200 Subject: [PATCH] [gdb/testsuite] Fix waitpid testing in next-fork-other-thread.c In next-fork-other-thread.c, there's this loop: ... do { ret = waitpid (pid, &stat, 0); } while (ret == EINTR); ... The loop condition tests for "ret == EINTR" but waitpid signals EINTR by returning -1 and setting errno to EINTR. Fix this by changing the loop condition to "ret == -1 && errno == EINTR". Tested on x86_64-linux. --- gdb/testsuite/gdb.threads/next-fork-other-thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.threads/next-fork-other-thread.c b/gdb/testsuite/gdb.threads/next-fork-other-thread.c index 377c1bc1a31..5bcdabe0464 100644 --- a/gdb/testsuite/gdb.threads/next-fork-other-thread.c +++ b/gdb/testsuite/gdb.threads/next-fork-other-thread.c @@ -44,7 +44,7 @@ forker (void *arg) do { ret = waitpid (pid, &stat, 0); - } while (ret == EINTR); + } while (ret == -1 && errno == EINTR); assert (ret == pid); assert (WIFEXITED (stat)); -- 2.30.2