aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-04 23:30:11 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-04 23:30:11 +0000
commit25ea3a5c20fe91cc4f98efb334be850a791cc08e (patch)
treea179f9dc5a7792c0f9e0a2c18f4fa043357d84e4
parent4b7920fed4c46489a1fed4a7564dc024c0ad8c62 (diff)
another LRN patch
-rw-r--r--src/util/os_priority.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 1b506fec2e..8bb7757f46 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -77,7 +77,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
#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 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
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 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,
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 @@ GNUNET_OS_start_process_v (const int *lsocks,
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 @@ GNUNET_OS_start_process_v (const int *lsocks,
}
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 @@ GNUNET_OS_process_status (struct GNUNET_OS_Process *proc,
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)
{