From 567f38888f93a02192a375aa59fce5754fb63162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Aug 2006 01:36:54 +0000 Subject: [PATCH] kill_thread() and friends are supposed to check the passed in thread_id or else some signals could go to some group when a negative value was passed in. This actually fixes bug #702 where SoundPlay obviously does a kill_thread(-1) at the end (which accidently killed all userspace applications, including the input_server, app_server, ...). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18683 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/thread.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/system/kernel/thread.c b/src/system/kernel/thread.c index 30d552a32e..67aa06c3be 100644 --- a/src/system/kernel/thread.c +++ b/src/system/kernel/thread.c @@ -1514,6 +1514,9 @@ exit_thread(status_t returnValue) status_t kill_thread(thread_id id) { + if (id <= 0) + return B_BAD_VALUE; + return send_signal(id, SIGKILLTHR); } @@ -1917,6 +1920,9 @@ wait_for_thread(thread_id thread, status_t *_returnCode) status_t suspend_thread(thread_id id) { + if (id <= 0) + return B_BAD_VALUE; + return send_signal(id, SIGSTOP); } @@ -1924,6 +1930,9 @@ suspend_thread(thread_id id) status_t resume_thread(thread_id id) { + if (id <= 0) + return B_BAD_VALUE; + return send_signal(id, SIGCONT); }