gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13557 - gnunet/src/util
Date: Fri, 5 Nov 2010 00:30:12 +0100

Author: grothoff
Date: 2010-11-05 00:30:11 +0100 (Fri, 05 Nov 2010)
New Revision: 13557

Modified:
   gnunet/src/util/os_priority.c
Log:
another LRN patch

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2010-11-04 23:24:20 UTC (rev 13556)
+++ gnunet/src/util/os_priority.c       2010-11-04 23:30:11 UTC (rev 13557)
@@ -77,7 +77,7 @@
 #if WINDOWS
   if (sig == SIGKILL || sig == SIGTERM)
   {
-    HANDLE h = GNUNET_OS_process_get_handle (proc);
+    HANDLE h = proc->handle;
     if (NULL == h)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -360,7 +360,6 @@
   char *arg;
   unsigned int cmdlen;
   char *cmd, *idx;
-  int findresult;
   STARTUPINFO start;
   PROCESS_INFORMATION proc;
   struct GNUNET_OS_Process *gnunet_proc = NULL;
@@ -400,8 +399,7 @@
       start.hStdOutput = stdout_handle;
     }
 
-  findresult = (int) FindExecutableA (filename, NULL, path);
-  if (findresult <= 32) 
+  if (32 >= FindExecutableA (filename, NULL, path)) 
     {
       SetErrnoFromWinError (GetLastError ());
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "FindExecutable", 
filename);
@@ -552,11 +550,19 @@
   STARTUPINFO start;
   PROCESS_INFORMATION proc;
   int argcount = 0;
-  char *non_const_filename = NULL;
+  char non_const_filename[MAX_PATH +1];
   int filenamelen = 0;
   struct GNUNET_OS_Process *gnunet_proc = NULL;
 
   GNUNET_assert (lsocks == NULL);
+
+  if (32 >= FindExecutableA (filename, NULL, non_const_filename)) 
+    {
+      SetErrnoFromWinError (GetLastError ());
+      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "FindExecutable", 
filename);
+      return NULL;
+    }
+
   /* Count the number of arguments */
   arg = (char **) argv;
   while (*arg)
@@ -579,19 +585,6 @@
     }
   non_const_argv[argcount] = NULL;
 
-  /* Fix .exe extension */
-  filenamelen = strlen (filename);
-  if (filenamelen <= 4 || stricmp (&filename[filenamelen - 4], ".exe") != 0)
-  {
-    non_const_filename = GNUNET_malloc (sizeof (char) * (filenamelen + 4 + 1));
-    non_const_filename = strcpy (non_const_filename, non_const_argv[0]);
-    strcat (non_const_filename, ".exe");
-    GNUNET_free (non_const_argv[0]);
-    non_const_argv[0] = non_const_filename;
-  }
-  else
-    non_const_filename = non_const_argv[0];
-
   /* Count cmd len */
   cmdlen = 1;
   arg = non_const_argv;
@@ -704,7 +697,7 @@
   HANDLE h;
   DWORD c, error_code, ret;
 
-  h = GNUNET_OS_process_get_handle (proc);
+  h = proc->handle;
   ret = proc->pid;
   if (h == NULL || ret == 0)
     {




reply via email to

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