#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,
extern GNUNET_SIGNAL_Handler w32_sigchld_handler;
+/**
+ * Make seaspider happy.
+ */
+#define DWORD_WINAPI DWORD WINAPI
+
/**
* @brief Waits for a process to terminate and invokes the SIGCHLD handler
* @param proc pointer to process structure
*/
-static DWORD WINAPI
+static DWORD_WINAPI
ChildWaitThread (void *arg)
{
struct GNUNET_OS_Process *proc = (struct GNUNET_OS_Process *) arg;
char *arg;
unsigned int cmdlen;
char *cmd, *idx;
- int findresult;
STARTUPINFO start;
PROCESS_INFORMATION proc;
struct GNUNET_OS_Process *gnunet_proc = NULL;
start.hStdOutput = stdout_handle;
}
- findresult = (int) FindExecutableA (filename, NULL, path);
- if (findresult <= 32)
+ if (32 >= (int) FindExecutableA (filename, NULL, path))
{
SetErrnoFromWinError (GetLastError ());
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "FindExecutable", filename);
STARTUPINFO start;
PROCESS_INFORMATION proc;
int argcount = 0;
- char *non_const_filename = NULL;
- int filenamelen = 0;
+ char non_const_filename[MAX_PATH +1];
struct GNUNET_OS_Process *gnunet_proc = NULL;
GNUNET_assert (lsocks == NULL);
+
+ if (32 >= (int) 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)
}
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;
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)
{