diff options
author | LRN <lrn1986@gmail.com> | 2012-07-13 16:24:41 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2012-07-13 16:24:41 +0000 |
commit | 50ee6f12db1596d610f7c56a635d3d985352f6c9 (patch) | |
tree | 3e59a307dfddce1ddc87d24d96c5ef7660c8ba0e /src/util/os_priority.c | |
parent | 3baea2d237e0b223fac6cbfa4fd3f830ecc16caa (diff) | |
download | gnunet-50ee6f12db1596d610f7c56a635d3d985352f6c9.tar.gz gnunet-50ee6f12db1596d610f7c56a635d3d985352f6c9.zip |
W32: correct handling of crazy W32 process quirks
Diffstat (limited to 'src/util/os_priority.c')
-rw-r--r-- | src/util/os_priority.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index b0668e20d..b20c3272d 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -464,12 +464,27 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) | |||
464 | if (0 == SafeTerminateProcess (proc->handle, 0, 0)) | 464 | if (0 == SafeTerminateProcess (proc->handle, 0, 0)) |
465 | { | 465 | { |
466 | DWORD error_code = GetLastError (); | 466 | DWORD error_code = GetLastError (); |
467 | if (error_code != WAIT_TIMEOUT) /* OK, since timeout is 0 */ | 467 | if ((error_code != WAIT_TIMEOUT) && (error_code != ERROR_PROCESS_ABORTED)) |
468 | { | 468 | { |
469 | LOG (GNUNET_ERROR_TYPE_WARNING, | 469 | LOG ((error_code == ERROR_ACCESS_DENIED) ? |
470 | GNUNET_ERROR_TYPE_INFO : GNUNET_ERROR_TYPE_WARNING, | ||
470 | "SafeTermiateProcess failed with code %lu\n", error_code); | 471 | "SafeTermiateProcess failed with code %lu\n", error_code); |
471 | SetErrnoFromWinError (error_code); | 472 | /* The problem here is that a process that is already dying |
472 | return -1; | 473 | * might cause SafeTerminateProcess to fail with |
474 | * ERROR_ACCESS_DENIED, but the process WILL die eventually. | ||
475 | * If we really had a permissions problem, hanging up (which | ||
476 | * is what will happen in process_wait() in that case) is | ||
477 | * a valid option. | ||
478 | */ | ||
479 | if (error_code == ERROR_ACCESS_DENIED) | ||
480 | { | ||
481 | errno = 0; | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | SetErrnoFromWinError (error_code); | ||
486 | return -1; | ||
487 | } | ||
473 | } | 488 | } |
474 | } | 489 | } |
475 | } | 490 | } |