* Makefile.msvc (OBJECTS): Remove strpbrk.obj.
(strpbrk.obj): Remove rule.
+ * w32spawn.h (dup_noinherit): Cast _get_osfhandle result and
+ _open_osfhandle argument, to avoid warnings.
+ (prepare_spawn): Add a cast.
+ * execute.c (execute) [WIN32]: Don't call wait_subprocess; the
+ return value from spawnvp is already the exit code.
+
2003-05-10 Bruno Haible <bruno@clisp.org>
* linebreak.c (iconv_string_length): Don't return -1 just because the
int orig_stdin;
int orig_stdout;
int orig_stderr;
- int child;
+ int exitcode;
int nullinfd;
int nulloutfd;
orig_stdout = dup_noinherit (STDOUT_FILENO);
if (null_stderr)
orig_stderr = dup_noinherit (STDERR_FILENO);
- child = -1;
+ exitcode = -1;
/* Create standard file handles of child process. */
nullinfd = -1;
&& ((null_stdout && nulloutfd == STDOUT_FILENO)
|| (null_stderr && nulloutfd == STDERR_FILENO)
|| close (nulloutfd) >= 0))))
- child = spawnvp (P_WAIT, prog_path, prog_argv);
+ exitcode = spawnvp (P_WAIT, prog_path, prog_argv);
if (nulloutfd >= 0)
close (nulloutfd);
if (nullinfd >= 0)
if (null_stdin)
dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
- if (child == -1)
+ if (exitcode == -1)
{
if (exit_on_error)
error (EXIT_FAILURE, errno, _("%s subprocess failed"), progname);
return 127;
}
+ return exitcode;
+
#else
/* Unix API. */
else
return 127;
}
-#endif
-
#endif
return wait_subprocess (child, progname, exit_on_error);
+
+#endif
}
dup_noinherit (int fd)
{
HANDLE curr_process = GetCurrentProcess ();
- HANDLE old_handle = _get_osfhandle (fd);
+ HANDLE old_handle = (HANDLE) _get_osfhandle (fd);
HANDLE new_handle;
int nfd;
error (EXIT_FAILURE, 0, _("DuplicateHandle failed with error code 0x%08x"),
GetLastError ());
- nfd = _open_osfhandle (new_handle, O_BINARY);
+ nfd = _open_osfhandle ((long) new_handle, O_BINARY);
if (nfd < 0)
error (EXIT_FAILURE, errno, _("_open_osfhandle failed"));
new_argv[i] = quoted_string;
}
else
- new_argv[i] = string;
+ new_argv[i] = (char *) string;
}
new_argv[argc] = NULL;