From 6c45d5614a1aa9e9f9dde413e878149d2d9711e3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:12:03 -0400 Subject: [PATCH] Minor refactoring in simple_exec_w32.c --- lib/roken/simple_exec_w32.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/roken/simple_exec_w32.c b/lib/roken/simple_exec_w32.c index 201fd4134..ae778ce60 100644 --- a/lib/roken/simple_exec_w32.c +++ b/lib/roken/simple_exec_w32.c @@ -48,7 +48,7 @@ RCSID("$Id$"); * @param[in] pid Process id for the monitored process * @param[in] func Timeout callback function. When the wait times out, - * the callback function is called. THe possible return values + * the callback function is called. The possible return values * from the callback function are: * * - ((time_t) -2) Exit loop without killing child and return SE_E_EXECTIMEOUT. @@ -72,13 +72,17 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process_timed(pid_t pid, time_t (*func)(void *), void *ptr, time_t timeout) { - HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); + HANDLE hProcess; DWORD wrv = 0; DWORD dtimeout; int rv = 0; - if (hProcess == NULL) + hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); + + if (hProcess == NULL) { + DWORD dw = GetLastError(); return SE_E_WAITPIDFAILED; + } dtimeout = (DWORD) ((timeout == 0)? INFINITE: timeout * 1000); -- 2.11.4.GIT