about summary refs log tree commit diff
path: root/debug/tst-longjmp_chk2.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-06-23 11:00:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-06-23 11:00:36 +0200
commit14699b6e371fa2dae3a989c9b1ead4f23a285545 (patch)
tree9ac34cd89f25d90633870579d92e9874526fe54c /debug/tst-longjmp_chk2.c
parent4e9bf327ad02ed83bded4011af68613e6b03ab33 (diff)
downloadglibc-14699b6e371fa2dae3a989c9b1ead4f23a285545.tar.gz
glibc-14699b6e371fa2dae3a989c9b1ead4f23a285545.tar.xz
glibc-14699b6e371fa2dae3a989c9b1ead4f23a285545.zip
test-skeleton.c: Add write_message function
Diffstat (limited to 'debug/tst-longjmp_chk2.c')
-rw-r--r--debug/tst-longjmp_chk2.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/debug/tst-longjmp_chk2.c b/debug/tst-longjmp_chk2.c
index 243568c32e..23d3436d1d 100644
--- a/debug/tst-longjmp_chk2.c
+++ b/debug/tst-longjmp_chk2.c
@@ -12,18 +12,20 @@
 #include <sys/resource.h>
 #include <unistd.h>
 
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
 
 static jmp_buf mainloop;
 static sigset_t mainsigset;
 static volatile sig_atomic_t pass;
 
 static void
-write_message (const char *message)
+write_indented (const char *str)
 {
-  ssize_t unused __attribute__ ((unused));
   for (int i = 0; i < pass; ++i)
-    unused = write (STDOUT_FILENO, " ", 1);
-  unused = write (STDOUT_FILENO, message, strlen (message));
+    write_message (" ");
+  write_message (str);
 }
 
 static void
@@ -33,11 +35,10 @@ stackoverflow_handler (int sig)
   /* Sanity check to keep test from looping forever (in case the longjmp
      chk code is slightly broken).  */
   pass++;
-  assert (pass < 5);
   sigaltstack (NULL, &altstack);
-  write_message ("in signal handler\n");
+  write_indented ("in signal handler\n");
   if (altstack.ss_flags & SS_ONSTACK)
-    write_message ("on alternate stack\n");
+    write_indented ("on alternate stack\n");
   siglongjmp (mainloop, pass);
 }
 
@@ -127,6 +128,3 @@ do_test (void)
 
   return 0;
 }
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"