public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Fix waitpid testing in next-fork-other-thread.c
@ 2022-10-02 18:18 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-10-02 18:18 UTC (permalink / raw)
  To: gdb-patches

Hi,

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.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix waitpid testing in next-fork-other-thread.c

---
 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));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-02 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-02 18:18 [committed][gdb/testsuite] Fix waitpid testing in next-fork-other-thread.c Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).