Module Name:    src
Committed By:   christos
Date:           Mon Dec 19 03:16:06 UTC 2011

Modified Files:
        src/external/bsd/atf/dist/atf-run: timer.cpp

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/atf-run/timer.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-run/timer.cpp
diff -u src/external/bsd/atf/dist/atf-run/timer.cpp:1.2 src/external/bsd/atf/dist/atf-run/timer.cpp:1.3
--- src/external/bsd/atf/dist/atf-run/timer.cpp:1.2	Sun Dec 18 17:34:06 2011
+++ src/external/bsd/atf/dist/atf-run/timer.cpp	Sun Dec 18 22:16:05 2011
@@ -128,9 +128,10 @@ impl::child_timer::~child_timer(void)
 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);
 }

Reply via email to