recovering from an unexpected backend termination.
The remaining patches are to allow whitespace in db/install directory
names.
Claudio Natoli
* 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 $
*
*-------------------------------------------------------------------------
*/
#ifdef EXEC_BACKEND
/* If Exec case, just attach and return the pointer */
- if (UsedShmemSegAddr != NULL && !makePrivate)
+ if (UsedShmemSegAddr != NULL && !makePrivate && IsUnderPostmaster)
{
void* origUsedShmemSegAddr = UsedShmemSegAddr;
*
* 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));
*
*
* 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);
HANDLE waiterThread;
/* Format the cmd line */
- snprintf(cmdLine,sizeof(cmdLine),"%s",path);
+ snprintf(cmdLine,sizeof(cmdLine),"\"%s\"",path);
i = 0;
while (argv[++i] != NULL)
{