gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r22241 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r22241 - gnunet/src/util
Date: Sun, 24 Jun 2012 00:29:39 +0200

Author: grothoff
Date: 2012-06-24 00:29:39 +0200 (Sun, 24 Jun 2012)
New Revision: 22241

Modified:
   gnunet/src/util/os_priority.c
Log:
-LRN: Better process termination for W32:
  Avoids spewing warnings about killing processes that are already
dead. Also removes a FIXME.



Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2012-06-23 22:28:37 UTC (rev 22240)
+++ gnunet/src/util/os_priority.c       2012-06-23 22:29:39 UTC (rev 22241)
@@ -455,10 +455,17 @@
   case SIGKILL:
   case SIGTERM:
 #if WINDOWS && !defined(__CYGWIN__)
-    if (0 == TerminateProcess (proc->handle, 0))
     {
-      /* FIXME: set 'errno' */
-      return -1;
+      DWORD exitcode;
+      int must_kill = GNUNET_YES;
+      if (0 != GetExitCodeProcess (proc->handle, &exitcode))
+        must_kill = (exitcode == STILL_ACTIVE) ? GNUNET_YES : GNUNET_NO;
+      if (GNUNET_YES == must_kill)
+        if (0 == TerminateProcess (proc->handle, 0))
+        {
+          SetErrnoFromWinError (GetLastError ());
+          return -1;
+        }
     }
     return 0;
 #else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]