Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils/kill.cc')
-rw-r--r--winsup/utils/kill.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index b0a2e1f65..c5b61c616 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -129,13 +129,17 @@ static void __stdcall
forcekill (int pid, int sig, int wait)
{
external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
- if (!p)
- return;
- HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
+ DWORD dwpid = p ? p->dwProcessId : (DWORD) pid;
+ HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid);
if (!h)
+ {
+ fprintf (stderr, "couldn't open pid %u\n", (unsigned) dwpid);
return;
+ }
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
- TerminateProcess (h, sig << 8);
+ if (!TerminateProcess (h, sig << 8))
+ fprintf (stderr, "couldn't kill pid %u, %u\n", (unsigned) dwpid,
+ (unsigned) GetLastError ());
CloseHandle (h);
}