Remove return that ended up with a memory leak in cs.c
[akaros.git] / tests / hello.c
index 2555df7..d2ff46f 100644 (file)
@@ -4,11 +4,19 @@
 #include <unistd.h>
 #include <signal.h>
 
-int main(int argc, char** argv)
+static void sig_hand(int signr)
 {
+       printf("Got posix signal %d\n", signr);
+}
+
+struct sigaction sigact = {.sa_handler = sig_hand, 0};
+
+int main(int argc, char **argv)
+{
+       sigaction(SIGTERM, &sigact, 0);
        printf("Hello world from program %s!!\n", argv[0]);
-       kill(getpid(), SIGTERM);
        sys_block(5000);
+       kill(getpid(), SIGTERM);
        printf("Done\n");
        return 0;
 }