* [PATCH] Fix tst-timer{2,4}
@ 2004-08-11 21:19 Jakub Jelinek
2004-08-11 23:33 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-08-11 21:19 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
These two testcases segfault if timer_create fails, which is IMHO not a good
thing. Using a timer_t after timer_create failed is also a bad example, so
we should avoid that.
2004-08-11 Jakub Jelinek <jakub@redhat.com>
* rt/tst-timer2.c (do_test): If timer_create fails, just continue.
* rt/tst-timer4.c (do_test): If one of the timer_create calls fails,
return 1 immediately.
--- libc/rt/tst-timer2.c.jj 2004-04-13 10:42:54.000000000 +0200
+++ libc/rt/tst-timer2.c 2004-08-11 23:02:39.938193370 +0200
@@ -40,7 +40,10 @@ do_test (void)
printf ("cnt = %d\n", i);
if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0)
- perror ("timer_create");
+ {
+ perror ("timer_create");
+ continue;
+ }
res = timer_settime (timerId, 0, &itval, NULL);
if (res < 0)
--- libc/rt/tst-timer4.c.jj 2004-04-21 10:06:06.000000000 +0200
+++ libc/rt/tst-timer4.c 2004-08-11 23:08:57.886378961 +0200
@@ -206,7 +206,7 @@ do_test (void)
if (timer_create (CLOCK_REALTIME, &ev, &timer_none) != 0)
{
printf ("*** timer_create for timer_none failed: %m\n");
- result = 1;
+ return 1;
}
struct sigaction sa = { .sa_sigaction = sig1_handler,
@@ -223,7 +223,7 @@ do_test (void)
if (timer_create (CLOCK_REALTIME, &ev, &timer_sig1) != 0)
{
printf ("*** timer_create for timer_sig1 failed: %m\n");
- result = 1;
+ return 1;
}
memset (&ev, 0x33, sizeof (ev));
@@ -233,7 +233,7 @@ do_test (void)
if (timer_create (CLOCK_REALTIME, &ev, &timer_sig2) != 0)
{
printf ("*** timer_create for timer_sig2 failed: %m\n");
- result = 1;
+ return 1;
}
memset (&ev, 0x44, sizeof (ev));
@@ -244,7 +244,7 @@ do_test (void)
if (timer_create (CLOCK_REALTIME, &ev, &timer_thr1) != 0)
{
printf ("*** timer_create for timer_thr1 failed: %m\n");
- result = 1;
+ return 1;
}
pthread_attr_t nattr;
@@ -263,7 +263,7 @@ do_test (void)
if (timer_create (CLOCK_REALTIME, &ev, &timer_thr2) != 0)
{
printf ("*** timer_create for timer_thr2 failed: %m\n");
- result = 1;
+ return 1;
}
int ret = timer_getoverrun (timer_thr1);
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix tst-timer{2,4}
2004-08-11 21:19 [PATCH] Fix tst-timer{2,4} Jakub Jelinek
@ 2004-08-11 23:33 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2004-08-11 23:33 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
> 2004-08-11 Jakub Jelinek <jakub@redhat.com>
>
> * rt/tst-timer2.c (do_test): If timer_create fails, just continue.
> * rt/tst-timer4.c (do_test): If one of the timer_create calls fails,
> return 1 immediately.
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-11 23:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-11 21:19 [PATCH] Fix tst-timer{2,4} Jakub Jelinek
2004-08-11 23:33 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).