summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog20
-rw-r--r--function.c12
-rw-r--r--job.c17
-rw-r--r--main.c22
4 files changed, 49 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index f77391c..97cf81d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2010-07-09 Eli Zaretskii <eliz@gnu.org>
+
+ * job.c (pid2str) [WINDOWS32]: Don't use %Id with GCC < 4.x.
+ (exec_command) [WINDOWS32]: Use pid2str instead of non-portable
+ %Id.
+
+ * main.c (handle_runtime_exceptions): Use %p to print addresses,
+ to DTRT on both 32-bit and 64-bit hosts. Savannah bug #27809.
+
+ * job.c (w32_kill, start_job_command, create_batch_file): Use
+ pid_t for process IDs and intptr_t for the 1st arg of
+ _open_osfhandle.
+ * function.c (windows32_openpipe): Use pid_t for process IDs and
+ intptr_t for the 1st arg of _open_osfhandle.
+ (func_shell): Use pid_t for process IDs.
+ * main.c (main) [WINDOWS32]: Pacify the compiler.
+ * config.h.W32.template (pid_t): Add a definition for 64-bit
+ Windows builds that don't use GCC.
+ Savannah bug #27809. Patch by Ozkan Sezer <sezeroz@gmail.com>
+
2010-07-06 Paul Smith <psmith@gnu.org>
* main.c (main): Set a default value of "-c" for .SHELLFLAGS.
diff --git a/function.c b/function.c
index d2482b5..45ebc9e 100644
--- a/function.c
+++ b/function.c
@@ -1434,7 +1434,7 @@ int shell_function_pid = 0, shell_function_completed;
void
-windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
+windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp)
{
SECURITY_ATTRIBUTES saAttr;
HANDLE hIn;
@@ -1489,13 +1489,13 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
process_register(hProcess);
/* set the pid for returning to caller */
- *pid_p = (int) hProcess;
+ *pid_p = (pid_t) hProcess;
/* set up to read data from child */
- pipedes[0] = _open_osfhandle((long) hChildOutRd, O_RDONLY);
+ pipedes[0] = _open_osfhandle((intptr_t) hChildOutRd, O_RDONLY);
/* this will be closed almost right away */
- pipedes[1] = _open_osfhandle((long) hChildOutWr, O_APPEND);
+ pipedes[1] = _open_osfhandle((intptr_t) hChildOutWr, O_APPEND);
} else {
/* reap/cleanup the failed process */
process_cleanup(hProcess);
@@ -1510,7 +1510,7 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
/* set status for return */
pipedes[0] = pipedes[1] = -1;
- *pid_p = -1;
+ *pid_p = (pid_t)-1;
}
}
#endif
@@ -1594,7 +1594,7 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
const char *error_prefix;
char **envp;
int pipedes[2];
- int pid;
+ pid_t pid;
#ifndef __MSDOS__
/* Construct the argument list. */
diff --git a/job.c b/job.c
index 8e83a47..49b95f7 100644
--- a/job.c
+++ b/job.c
@@ -192,7 +192,7 @@ static const char *
pid2str (pid_t pid)
{
static char pidstring[100];
-#ifdef WINDOWS32
+#if defined(WINDOWS32) && __GNUC__ > 3
sprintf (pidstring, "%Id", pid);
#else
sprintf (pidstring, "%lu", (unsigned long) pid);
@@ -247,7 +247,7 @@ unsigned int jobserver_tokens = 0;
* The macro which references this function is defined in make.h.
*/
int
-w32_kill(int pid, int sig)
+w32_kill(pid_t pid, int sig)
{
return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1);
}
@@ -315,7 +315,7 @@ create_batch_file (char const *base, int unixy, int *fd)
const unsigned final_size = path_size + size + 1;
char *const path = xmalloc (final_size);
memcpy (path, temp_path, final_size);
- *fd = _open_osfhandle ((long)h, 0);
+ *fd = _open_osfhandle ((intptr_t)h, 0);
if (unixy)
{
char *p;
@@ -1393,7 +1393,7 @@ start_job_command (struct child *child)
hPID = process_easy(argv, child->environment);
if (hPID != INVALID_HANDLE_VALUE)
- child->pid = (int) hPID;
+ child->pid = (pid_t) hPID;
else {
int i;
unblock_sigs();
@@ -2068,9 +2068,14 @@ exec_command (char **argv, char **envp)
if (hWaitPID == hPID)
break;
else
+ {
+ char *pidstr = xstrdup (pid2str ((DWORD_PTR)hWaitPID));
+
fprintf(stderr,
- _("make reaped child pid %Iu, still waiting for pid %Iu\n"),
- (DWORD_PTR)hWaitPID, (DWORD_PTR)hPID);
+ _("make reaped child pid %s, still waiting for pid %s\n"),
+ pidstr, pid2str ((DWORD_PTR)hPID));
+ free (pidstr);
+ }
}
/* return child's exit code as our exit code */
diff --git a/main.c b/main.c
index c972e65..d7f3253 100644
--- a/main.c
+++ b/main.c
@@ -681,24 +681,24 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
if (! ISDB (DB_VERBOSE))
{
sprintf(errmsg,
- _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%lx)\n"),
- prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);
+ _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%p)\n"),
+ prg, exrec->ExceptionCode, exrec->ExceptionAddress);
fprintf(stderr, errmsg);
exit(255);
}
sprintf(errmsg,
- _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),
+ _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = 0x%p\n"),
prg, exrec->ExceptionCode, exrec->ExceptionFlags,
- (DWORD)exrec->ExceptionAddress);
+ exrec->ExceptionAddress);
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
&& exrec->NumberParameters >= 2)
sprintf(&errmsg[strlen(errmsg)],
(exrec->ExceptionInformation[0]
- ? _("Access violation: write operation at address %lx\n")
- : _("Access violation: read operation at address %lx\n")),
- exrec->ExceptionInformation[1]);
+ ? _("Access violation: write operation at address 0x%p\n")
+ : _("Access violation: read operation at address 0x%p\n")),
+ (PVOID)exrec->ExceptionInformation[1]);
/* turn this on if we want to put stuff in the event log too */
#ifdef USE_EVENT_LOG
@@ -967,8 +967,10 @@ main (int argc, char **argv, char **envp)
/* Set up gettext/internationalization support. */
setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
+ /* The cast to void shuts up compiler warnings on systems that
+ disable NLS. */
+ (void)bindtextdomain (PACKAGE, LOCALEDIR);
+ (void)textdomain (PACKAGE);
#ifdef POSIX
sigemptyset (&fatal_signal_set);
@@ -1400,7 +1402,7 @@ main (int argc, char **argv, char **envp)
/* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
But allow -C/ just in case someone wants that. */
{
- char *p = dir + strlen (dir) - 1;
+ char *p = (char *)dir + strlen (dir) - 1;
while (p > dir && (p[0] == '/' || p[0] == '\\'))
--p;
p[1] = '\0';