recovering from an unexpected backend termination.
The remaining patches are to allow whitespace in db/install directory
names.
Claudio Natoli
index 1c03fe4866b4df56a8b0c4004244b4cf018eabf1..1aca81f68b8b96528d14c438b9c1b14054afa178 100644 (file)
* 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;
index 1267acbbcbe7bfd06dcd866e4fb5034927d328f3..65a37fd6a38b0001a03ddd3ad4d16611dfb447aa 100644 (file)
*
* 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"
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));
index 3cbd40f3db63914fc2be994e389a643132189cb5..1d781d0bb5afb2b346fcceeabeb2c76e30700e85 100644 (file)
*
*
* 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
*
/* 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));
#endif
#else
char idbuf[32];
+ char ddirbuf[MAXPGPATH];
#endif
fflush(stdout);
#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)
{