* [PATCH] Fix test-skeleton.c timeout handling
@ 2003-06-19 11:37 Jakub Jelinek
2003-06-25 7:56 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-06-19 11:37 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
If waitpid returns 0, timeout_handler would still happily access the random
value in status.
2003-06-19 Jakub Jelinek <jakub@redhat.com>
* test-skeleton.c (timeout_handler): If waitpid returned 0,
retry once after a second. If killed == 0, assume
WTERMSIG (status) == SIGKILL.
--- libc/test-skeleton.c.jj 2003-06-07 19:23:01.000000000 -0400
+++ libc/test-skeleton.c 2003-06-19 05:40:53.000000000 -0400
@@ -140,9 +140,14 @@ timeout_handler (int sig __attribute__ (
/* Wait for it to terminate. */
killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
+ if (killed == 0)
+ {
+ sleep (1);
+ killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
+ }
if (killed != 0 && killed != pid)
{
- perror ("Failed to killed test process");
+ perror ("Failed to kill test process");
exit (1);
}
@@ -156,7 +161,7 @@ timeout_handler (int sig __attribute__ (
exit (0);
#endif
- if (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)
+ if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
fputs ("Timed out: killed the child process\n", stderr);
else if (WIFSTOPPED (status))
fprintf (stderr, "Timed out: the child process was %s\n",
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix test-skeleton.c timeout handling
2003-06-19 11:37 [PATCH] Fix test-skeleton.c timeout handling Jakub Jelinek
@ 2003-06-25 7:56 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-06-25 7:56 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Roland McGrath, Glibc hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jakub Jelinek wrote:
> 2003-06-19 Jakub Jelinek <jakub@redhat.com>
>
> * test-skeleton.c (timeout_handler): If waitpid returned 0,
> retry once after a second. If killed == 0, assume
> WTERMSIG (status) == SIGKILL.
I've applied this patch, slightly changed.
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE++VDt2ijCOnn/RHQRApdbAJ9stSX1oTJCvrL5TTkSHXWi597fbACfQkH7
E+T/hnLfKMF+EQaLbwefsqA=
=TPiM
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-25 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-19 11:37 [PATCH] Fix test-skeleton.c timeout handling Jakub Jelinek
2003-06-25 7:56 ` Ulrich Drepper
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).