bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH hurd 3/6] Fix warnings in fstests


From: Flavio Cruz
Subject: [PATCH hurd 3/6] Fix warnings in fstests
Date: Sun, 21 Jan 2024 16:07:54 -0500

---
 fstests/fstests.c   |  1 -
 fstests/timertest.c | 10 ++++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fstests/fstests.c b/fstests/fstests.c
index b776503..ca60203 100644
--- a/fstests/fstests.c
+++ b/fstests/fstests.c
@@ -94,7 +94,6 @@ main (void)
 #endif
 
   printf ("All done.\n");
-  malloc (0);
 
   return 0;
 }
diff --git a/fstests/timertest.c b/fstests/timertest.c
index 2d60256..6eca98e 100644
--- a/fstests/timertest.c
+++ b/fstests/timertest.c
@@ -32,14 +32,20 @@ alarm_handler (int signo)
 int
 main(int argc, char *argv[])
 {
+  struct sigaction alarm_sigaction = { 0 };
+  sigset_t empty_sigset;
   struct itimerval real_timer;
 
+  sigemptyset (&empty_sigset);
+
   real_timer.it_interval.tv_usec = 0;
   real_timer.it_interval.tv_sec = 1;
   real_timer.it_value.tv_usec = 0;
   real_timer.it_value.tv_sec = 1;
 
-  signal (SIGALRM, alarm_handler);
+  alarm_sigaction.sa_handler = &alarm_handler;
+  alarm_sigaction.sa_flags = SA_RESTART;
+  sigaction (SIGALRM, &alarm_sigaction, NULL);
 
   if (setitimer (ITIMER_REAL, &real_timer, 0) < 0)
     error (1, errno, "Setting timer");
@@ -56,7 +62,7 @@ main(int argc, char *argv[])
        {
          puts ("Saw EOF.  Pausing (no input)...");
          fflush (stdout);
-         sigpause (0);
+         sigsuspend (&empty_sigset);
        }
       else
        printf ("Saw %.3o\n", c);
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]