sysv_shmem.c patch is to correct a bug that prevents the postmaster

recovering from an unexpected backend termination.

The remaining patches are to allow whitespace in db/install directory
names.

Claudio Natoli
This commit is contained in:
Bruce Momjian 2004-05-06 19:23:25 +00:00
parent 22a2c4b576
commit 38b85b15c1
3 changed files with 13 additions and 13 deletions

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.33 2004/04/19 17:42:58 momjian Exp $
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.34 2004/05/06 19:23:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -250,7 +250,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
#ifdef EXEC_BACKEND
/* If Exec case, just attach and return the pointer */
if (UsedShmemSegAddr != NULL && !makePrivate)
if (UsedShmemSegAddr != NULL && !makePrivate && IsUnderPostmaster)
{
void* origUsedShmemSegAddr = UsedShmemSegAddr;

View File

@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.67 2004/04/19 17:42:58 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.68 2004/05/06 19:23:25 momjian Exp $
* ----------
*/
#include "postgres.h"
@ -485,11 +485,10 @@ pgstat_forkexec(STATS_PROCESS_TYPE procType)
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%d",MaxBackends);
/* + the pstat file names, and postgres pathname */
/* FIXME: [fork/exec] whitespaces in directories? */
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_tmpfname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_fname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pg_pathname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",DataDir);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_tmpfname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_fname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pg_pathname);
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
/* Add to the arg list */
Assert(bufc <= lengthof(pgstatBuf));

View File

@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.381 2004/04/19 17:42:58 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.382 2004/05/06 19:23:25 momjian Exp $
*
* NOTES
*
@ -2741,8 +2741,7 @@ Backend_forkexec(Port *port)
/* Format up context to pass to exec'd process */
snprintf(buf[bufc++],MAXPGPATH,"%lu",tmpBackendFileNum);
/* FIXME: [fork/exec] whitespaces in directories? */
snprintf(buf[bufc++],MAXPGPATH,"%s",DataDir);
snprintf(buf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
/* Add to the arg list */
Assert(bufc <= lengthof(buf));
@ -3039,6 +3038,7 @@ SSDataBase(int xlop)
#endif
#else
char idbuf[32];
char ddirbuf[MAXPGPATH];
#endif
fflush(stdout);
@ -3097,8 +3097,9 @@ SSDataBase(int xlop)
#ifdef EXEC_BACKEND
/* pass data dir before end of secure switches (-p) */
snprintf(ddirbuf, MAXPGPATH, "\"%s\"", DataDir);
av[ac++] = "-D";
av[ac++] = DataDir;
av[ac++] = ddirbuf;
/* and the backend identifier + dbname */
snprintf(idbuf, sizeof(idbuf), "-p%lu,template1", tmpBackendFileNum);
@ -3490,7 +3491,7 @@ pid_t win32_forkexec(const char* path, char *argv[])
HANDLE waiterThread;
/* Format the cmd line */
snprintf(cmdLine,sizeof(cmdLine),"%s",path);
snprintf(cmdLine,sizeof(cmdLine),"\"%s\"",path);
i = 0;
while (argv[++i] != NULL)
{