about summary refs log tree commit diff
path: root/stdlib/tst-setcontext.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-12-03 04:12:05 +0000
committerUlrich Drepper <drepper@redhat.com>2007-12-03 04:12:05 +0000
commitd90d025691b584812ecaf216be6fbf17c7f0a0a3 (patch)
tree13ff1356587446d8de8ff76c8751f45115cba848 /stdlib/tst-setcontext.c
parent9e80c1231e9509726c83cfb5b0e794e753ff8baa (diff)
downloadglibc-d90d025691b584812ecaf216be6fbf17c7f0a0a3.tar.gz
glibc-d90d025691b584812ecaf216be6fbf17c7f0a0a3.tar.xz
glibc-d90d025691b584812ecaf216be6fbf17c7f0a0a3.zip
* stdlib/tst-setcontext.c: Catch the case where the links gets
	messed up and we do not reach main again.
Diffstat (limited to 'stdlib/tst-setcontext.c')
-rw-r--r--stdlib/tst-setcontext.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c
index e8b1e22671..28bf230264 100644
--- a/stdlib/tst-setcontext.c
+++ b/stdlib/tst-setcontext.c
@@ -123,9 +123,26 @@ test_stack(volatile int a, volatile int b,
 
 volatile int global;
 
+
+static int back_in_main;
+
+
+static void
+check_called (void)
+{
+  if (back_in_main == 0)
+    {
+      puts ("program did no reach main again");
+      _exit (1);
+    }
+}
+
+
 int
 main (void)
 {
+  atexit (check_called);
+
   char st1[32768];
 
   puts ("making contexts");
@@ -185,6 +202,7 @@ main (void)
       exit (1);
     }
   puts ("back at main program");
+  back_in_main = 1;
 
   if (was_in_f1 == 0)
     {