Use new typedef to normalize pids for printing on both 32- and 64-bit Cygwin.
---
winsup/utils/profiler.cc | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/winsup/utils/profiler.cc b/winsup/utils/profiler.cc
index d1a01c3a2..152bf1cca 100644
--- a/winsup/utils/profiler.cc
+++ b/winsup/utils/profiler.cc
@@ -29,6 +29,7 @@
#include "cygwin/version.h"
#include "cygtls_padsize.h"
#include "gcc_seh.h"
+typedef unsigned long ulong;
typedef unsigned short ushort;
typedef uint16_t u_int16_t; // Non-standard sized type needed by ancient gmon.h
#define NO_GLOBALS_H
@@ -312,10 +313,10 @@ dump_profile_data (child *c)
if (s->name)
{
WCHAR *name = 1 + wcsrchr (s->name, L'\\');
- sprintf (filename, "%s.%u.%ls", prefix, c->pid, name);
+ sprintf (filename, "%s.%lu.%ls", prefix, (ulong) c->pid, name);
}
else
-sprintf (filename, "%s.%u", prefix, c->pid);
+sprintf (filename, "%s.%lu", prefix, (ulong) c->pid);
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY);
if (fd < 0)
@@ -804,9 +805,9 @@ cygwin_pid (DWORD winpid)
cygpid = (DWORD) cygwin_internal (CW_WINPID_TO_CYGWIN_PID, winpid);
if (cygpid >= max_cygpid)
-snprintf (buf, sizeof buf, "%u", winpid);
+snprintf (buf, sizeof buf, "%lu", (ulong) winpid);
else
-snprintf (buf, sizeof buf, "%u (pid: %u)", winpid, cygpid);
+snprintf (buf, sizeof buf, "%lu (pid: %lu)", (ulong) winpid, (ulong)
cygpid);
return buf;
}
--
2.32.0