From 5c267325ecd33ac76a674a789b0f0062eeeeb313 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 14 Oct 2004 20:23:46 +0000
Subject: [PATCH] Add 'int' cast for getpid() because some Solaris releases
 return long for getpid().

---
 src/backend/access/transam/xlog.c   | 8 ++++----
 src/backend/postmaster/pgstat.c     | 4 ++--
 src/backend/postmaster/postmaster.c | 4 ++--
 src/bin/psql/command.c              | 4 ++--
 src/interfaces/ecpg/ecpglib/misc.c  | 4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 52b3066a8d2..3b1f1a4beca 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.173 2004/10/12 21:54:35 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.174 2004/10/14 20:23:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1513,7 +1513,7 @@ XLogFileInit(uint32 log, uint32 seg,
 	 * up pre-creating an extra log segment.  That seems OK, and better
 	 * than holding the lock throughout this lengthy process.
 	 */
-	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid());
+	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, (int)getpid());
 
 	unlink(tmppath);
 
@@ -1633,7 +1633,7 @@ XLogFileCopy(uint32 log, uint32 seg,
 	/*
 	 * Copy into a temp file name.
 	 */
-	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid());
+	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, (int)getpid());
 
 	unlink(tmppath);
 
@@ -2898,7 +2898,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
 	/*
 	 * Write into a temp file name.
 	 */
-	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid());
+	snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, (int)getpid());
 
 	unlink(tmppath);
 
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 1641694f122..7daf7af0aa5 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
  *
  *	Copyright (c) 2001-2004, PostgreSQL Global Development Group
  *
- *	$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.80 2004/08/29 05:06:46 momjian Exp $
+ *	$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.81 2004/10/14 20:23:44 momjian Exp $
  * ----------
  */
 #include "postgres.h"
@@ -1505,7 +1505,7 @@ PgstatCollectorMain(int argc, char *argv[])
 	snprintf(pgStat_fname, MAXPGPATH, PGSTAT_STAT_FILENAME, DataDir);
 	/* tmpfname need only be set correctly in this process */
 	snprintf(pgStat_tmpfname, MAXPGPATH, PGSTAT_STAT_TMPFILE,
-			 DataDir, getpid());
+			 DataDir, (int)getpid());
 
 	/*
 	 * Arrange to write the initial status file right away
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 509dd7b9b64..96503e0a818 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.432 2004/10/12 21:54:40 petere Exp $
+ *	  $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.433 2004/10/14 20:23:45 momjian Exp $
  *
  * NOTES
  *
@@ -2760,7 +2760,7 @@ BackendRun(Port *port)
 	 */
 	ereport(DEBUG3,
 			(errmsg_internal("%s child[%d]: starting with (",
-							 progname, getpid())));
+							 progname, (int)getpid())));
 	for (i = 0; i < ac; ++i)
 		ereport(DEBUG3,
 				(errmsg_internal("\t%s", av[i])));
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 10b62276854..998a0027946 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.127 2004/10/09 02:46:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.128 2004/10/14 20:23:46 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -1133,7 +1133,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
 		const char *tmpdirenv = getenv("TMPDIR");
 
 		snprintf(fnametmp, sizeof(fnametmp), "%s/psql.edit.%d.%d",
-				 tmpdirenv ? tmpdirenv : "/tmp", geteuid(), getpid());
+				 tmpdirenv ? tmpdirenv : "/tmp", geteuid(), (int)getpid());
 #else
 		GetTempFileName(".", "psql", 0, fnametmp);
 #endif
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 1581df76174..709fd56f8ff 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.23 2004/10/09 02:46:42 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.24 2004/10/14 20:23:46 momjian Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -253,7 +253,7 @@ ECPGlog(const char *format,...)
 			return;
 		}
 
-		sprintf(f, "[%d]: %s", getpid(), format);
+		sprintf(f, "[%d]: %s", (int)getpid(), format);
 
 		va_start(ap, format);
 		vfprintf(debugstream, f, ap);
-- 
GitLab