Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/atf/dist/atf-run fix killing code I just broke, ...



details:   https://anonhg.NetBSD.org/src/rev/b6599138af3a
branches:  trunk
changeset: 772114:b6599138af3a
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 19 03:16:05 2011 +0000

description:
fix killing code I just broke, and give program a chance to cleanup.

diffstat:

 external/bsd/atf/dist/atf-run/timer.cpp |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (18 lines):

diff -r 8587c8a8821e -r b6599138af3a external/bsd/atf/dist/atf-run/timer.cpp
--- a/external/bsd/atf/dist/atf-run/timer.cpp   Mon Dec 19 03:02:31 2011 +0000
+++ b/external/bsd/atf/dist/atf-run/timer.cpp   Mon Dec 19 03:16:05 2011 +0000
@@ -128,9 +128,10 @@
 void
 impl::child_timer::timeout_callback(void)
 {
+    static const timespec ts = { 1, 0 };
     m_terminate = true;
-
-    // Should use killpg(2) but, according to signal(7), using this system
-    // call in a signal handler context is not safe.
-    ::killpg(-m_pid, SIGKILL);
+    ::kill(-m_pid, SIGTERM);
+    ::nanosleep(&ts, NULL);
+    if (::kill(-m_pid, 0) != -1)
+       ::kill(-m_pid, SIGKILL);
 }



Home | Main Index | Thread Index | Old Index