From 7cb34129142eb79d2891c00197ac0f3f50b27918 Mon Sep 17 00:00:00 2001 From: ramonn Date: Thu, 13 May 2010 15:39:52 +0000 Subject: [PATCH] 2010-05-13 Ramon Novoa * pandora_windows_service.cc: Check the return codee of the tentacle client. Fixes bug #2972399. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2722 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/win32/ChangeLog | 5 +++++ .../win32/pandora_windows_service.cc | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index 6227f5b553..e3972c1366 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,8 @@ +2010-05-13 Ramon Novoa + + * pandora_windows_service.cc: Check the return codee of the tentacle + client. Fixes bug #2972399. + 2010-05-12 Ramon Novoa * build.sh: Added to repository. Pandora Agent installer build script. diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 6764e5c4de..d37db09d20 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -232,7 +232,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host, string pass, string opts) { - bool rc = false; + DWORD rc; string var, filepath; string tentacle_cmd, working_dir; PROCESS_INFORMATION pi; @@ -273,16 +273,19 @@ Pandora_Windows_Service::copyTentacleDataFile (string host, ZeroMemory (&si, sizeof (si)); ZeroMemory (&pi, sizeof (pi)); - rc = CreateProcess (NULL , (CHAR *)tentacle_cmd.c_str (), NULL, NULL, FALSE, CREATE_NO_WINDOW, - NULL, NULL, &si, &pi); - WaitForSingleObject(pi.hProcess, INFINITE); - if (rc == true) { - return 0; + if (CreateProcess (NULL , (CHAR *)tentacle_cmd.c_str (), NULL, NULL, FALSE, + CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) { + return -1; } - pandoraDebug ("Tentacle client was unable to copy %s", - filename.c_str ()); - return -1; + /* Get the return code of the tentacle client*/ + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess (pi.hProcess, &rc); + if (rc != 0) { + return -1; + } + + return 0; } int