VBOX: Make sure we only check for the VM exit code if we have a valid handle.

This commit is contained in:
Rom Walton 2014-07-14 12:26:10 -04:00
parent 382aeb8814
commit d80f2e271c
1 changed files with 5 additions and 3 deletions

View File

@ -2059,12 +2059,14 @@ int VBOX_VM::get_vm_process_id() {
}
int VBOX_VM::get_vm_exit_code(unsigned long& exit_code) {
#ifndef _WIN32
#ifdef _WIN32
if (vm_pid_handle) {
GetExitCodeProcess(vm_pid_handle, &exit_code);
}
#else
int ec = 0;
waitpid(vm_pid, &ec, WNOHANG);
exit_code = ec;
#else
GetExitCodeProcess(vm_pid_handle, &exit_code);
#endif
return 0;
}