From: Christian Grothoff Date: Thu, 14 Jul 2011 17:11:56 +0000 (+0000) Subject: MAntis 1616, 0001-Temporary-fix-for-process_kill.patch X-Git-Tag: initial-import-from-subversion-38251~17872 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c0da3f7e247cad794e427ad862024dd97461d5e7;p=oweals%2Fgnunet.git MAntis 1616, 0001-Temporary-fix-for-process_kill.patch --- diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 4d2f98b00..acb121971 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -146,46 +146,26 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to write into control pipe , errno is %d\n", errno); +#if WINDOWS + res = 0; + TerminateProcess (proc->handle, 0); +#else res = PLIBC_KILL (proc->pid, sig); +#endif } else { - struct GNUNET_NETWORK_FDSet *rfds; - struct GNUNET_NETWORK_FDSet *efds; - - rfds = GNUNET_NETWORK_fdset_create (); - efds = GNUNET_NETWORK_fdset_create (); - - GNUNET_NETWORK_fdset_handle_set (rfds, proc->control_pipe); - GNUNET_NETWORK_fdset_handle_set (efds, proc->control_pipe); - - read_next: - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Wrote control code into control pipe, now waiting\n"); - - ret = GNUNET_NETWORK_socket_select (rfds, NULL, efds, - GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_unit (), - 5000)); - - if (ret < 1 || GNUNET_NETWORK_fdset_handle_isset (efds, - proc->control_pipe)) - { - /* Just to be sure */ - PLIBC_KILL (proc->pid, sig); - res = 0; - } - else - { - if (GNUNET_DISK_file_read (proc->control_pipe, &ret, - sizeof(ret)) != GNUNET_OK) - res = PLIBC_KILL (proc->pid, sig); - - /* Child signaled shutdown is in progress */ - goto read_next; - } - } - - return res; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Wrote control code into control pipe, now waiting\n"); + WaitForSingleObject (proc->handle, 5000); +#if WINDOWS + TerminateProcess (proc->handle, 0); +#else + PLIBC_KILL (proc->pid, sig); +#endif + res = 0; + } + return res; #else return kill (proc->pid, sig); #endif