mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Set progname early in the postmaster/postgres binary, rather than doing
it later. This fixes a problem where EXEC_BACKEND didn't have progname set, causing a segfault if log_min_messages was set below debug2 and our own snprintf.c was being used. Also alway strdup() progname. Backpatch to 8.1.X and 8.0.X.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.99 2006/01/05 03:01:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.100 2006/02/01 00:31:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "libpq/pqsignal.h"
|
||||
#endif
|
||||
|
||||
|
||||
const char *progname;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@@ -77,6 +77,8 @@ main(int argc, char *argv[])
|
||||
char *env_locale;
|
||||
#endif
|
||||
|
||||
progname = get_progname(argv[0]);
|
||||
|
||||
/*
|
||||
* On some platforms, unaligned memory accesses result in a kernel trap;
|
||||
* the default kernel behavior is to emulate the memory access, but this
|
||||
@@ -246,7 +248,7 @@ main(int argc, char *argv[])
|
||||
* possibly first argument) we were called with. The lack of consistency
|
||||
* here is historical.
|
||||
*/
|
||||
if (strcmp(get_progname(argv[0]), "postmaster") == 0)
|
||||
if (strcmp(progname, "postmaster") == 0)
|
||||
{
|
||||
/* Called as "postmaster" */
|
||||
exit(PostmasterMain(argc, argv));
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.479 2006/01/06 02:58:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.480 2006/02/01 00:31:59 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -171,9 +171,6 @@ char *ListenAddresses;
|
||||
*/
|
||||
int ReservedBackends;
|
||||
|
||||
|
||||
static const char *progname = NULL;
|
||||
|
||||
/* The socket(s) we're listening to. */
|
||||
#define MAXLISTEN 64
|
||||
static int ListenSocket[MAXLISTEN];
|
||||
@@ -383,9 +380,6 @@ PostmasterMain(int argc, char *argv[])
|
||||
char *userDoption = NULL;
|
||||
int i;
|
||||
|
||||
/* This will call exit() if strdup() fails. */
|
||||
progname = get_progname(argv[0]);
|
||||
|
||||
MyProcPid = PostmasterPid = getpid();
|
||||
|
||||
IsPostmasterEnvironment = true;
|
||||
|
||||
Reference in New Issue
Block a user