aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads/thread-execl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.threads/thread-execl.c')
-rw-r--r--gdb/testsuite/gdb.threads/thread-execl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.threads/thread-execl.c b/gdb/testsuite/gdb.threads/thread-execl.c
index 403aa31..2d312d4 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.c
+++ b/gdb/testsuite/gdb.threads/thread-execl.c
@@ -25,8 +25,9 @@ static const char *image;
void *
thread_execler (void *arg)
{
- /* Exec ourselves again. */
- if (execl (image, image, NULL) == -1)
+ /* Exec ourselves again. Pass an extra argument so that the
+ post-exec image knows to not re-exec yet again. */
+ if (execl (image, image, "1", NULL) == -1)
{
perror ("execl");
abort ();
@@ -40,6 +41,11 @@ main (int argc, char **argv)
{
pthread_t thread;
+ /* An extra argument means we're in the post-exec image, so we're
+ done. Don't re-exec again. */
+ if (argc > 1)
+ exit (0);
+
image = argv[0];
pthread_create (&thread, NULL, thread_execler, NULL);