PR gdb/9346
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interrupt.c
index 120697b77e5cc946a4048aab718e81c4a145bb56..80b906099e666f00909171e7ab54c9799293c833 100644 (file)
@@ -1,5 +1,17 @@
 #include <errno.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#ifdef SIGNALS
+#include <signal.h>
+
+static void
+sigint_handler (int signo)
+{
+}
+#endif
+
 int
 main ()
 {
@@ -8,6 +20,9 @@ main ()
 #ifdef usestubs
   set_debug_traps();
   breakpoint();
+#endif
+#ifdef SIGNALS
+  signal (SIGINT, sigint_handler);
 #endif
   printf ("talk to me baby\n");
   while (1)
@@ -18,7 +33,10 @@ main ()
 #ifdef EINTR
          if (errno != EINTR)
 #endif
-           perror ("");
+           {
+             perror ("");
+             return 1;
+           }
        }
       else if (nbytes == 0)
        {
@@ -28,6 +46,7 @@ main ()
       else
        write (1, &x, 1);
     }
+  return 0;
 }
 
 int
This page took 0.024935 seconds and 4 git commands to generate.