From 67608a393bf36990e4bebefdc4514db1321764ef Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 9 Oct 2004 02:46:42 +0000 Subject: [PATCH] Make getpid() use %d consistently for printing. --- src/backend/access/transam/xlog.c | 11 ++++------- src/backend/utils/error/elog.c | 8 ++++---- src/bin/psql/command.c | 7 +++---- src/interfaces/ecpg/ecpglib/misc.c | 4 ++-- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 6670455103..faa151384d 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.171 2004/10/07 15:21:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.172 2004/10/09 02:46:40 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1513,8 +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, (int) getpid()); + snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid()); unlink(tmppath); @@ -1634,8 +1633,7 @@ XLogFileCopy(uint32 log, uint32 seg, /* * Copy into a temp file name. */ - snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", - XLogDir, (int) getpid()); + snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid()); unlink(tmppath); @@ -2900,8 +2898,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, /* * Write into a temp file name. */ - snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", - XLogDir, (int) getpid()); + snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d", XLogDir, getpid()); unlink(tmppath); diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 1cef96f351..80833aee60 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.153 2004/10/09 01:24:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.154 2004/10/09 02:46:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1364,13 +1364,13 @@ log_line_prefix(StringInfo buf) case 'c': if (MyProcPort) { - appendStringInfo(buf, "%lx.%lx", + appendStringInfo(buf, "%lx.%x", (long) (MyProcPort->session_start.tv_sec), - (long) MyProcPid); + MyProcPid); } break; case 'p': - appendStringInfo(buf, "%ld", (long) MyProcPid); + appendStringInfo(buf, "%d", MyProcPid); break; case 'l': appendStringInfo(buf, "%ld", log_line_number); diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 3d8752a888..10b6227685 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.126 2004/10/07 15:21:56 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.127 2004/10/09 02:46:41 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1132,9 +1132,8 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf) #ifndef WIN32 const char *tmpdirenv = getenv("TMPDIR"); - snprintf(fnametmp, sizeof(fnametmp), "%s/psql.edit.%ld.%ld", - tmpdirenv ? tmpdirenv : "/tmp", - (long) geteuid(), (long) getpid()); + snprintf(fnametmp, sizeof(fnametmp), "%s/psql.edit.%d.%d", + tmpdirenv ? tmpdirenv : "/tmp", geteuid(), getpid()); #else GetTempFileName(".", "psql", 0, fnametmp); #endif diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 69789d9da1..1581df7617 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.22 2004/08/29 05:06:59 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.23 2004/10/09 02:46:42 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -253,7 +253,7 @@ ECPGlog(const char *format,...) return; } - sprintf(f, "[%d]: %s", (int) getpid(), format); + sprintf(f, "[%d]: %s", getpid(), format); va_start(ap, format); vfprintf(debugstream, f, ap); -- 2.40.0