Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38b85b1

Browse files
committed
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 directorynames.Claudio Natoli
1 parent22a2c4b commit38b85b1

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

‎src/backend/port/sysv_shmem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.33 2004/04/19 17:42:58 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.34 2004/05/06 19:23:25 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -250,7 +250,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
250250

251251
#ifdefEXEC_BACKEND
252252
/* If Exec case, just attach and return the pointer */
253-
if (UsedShmemSegAddr!=NULL&& !makePrivate)
253+
if (UsedShmemSegAddr!=NULL&& !makePrivate&&IsUnderPostmaster)
254254
{
255255
void*origUsedShmemSegAddr=UsedShmemSegAddr;
256256

‎src/backend/postmaster/pgstat.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*Copyright (c) 2001-2003, PostgreSQL Global Development Group
1515
*
16-
*$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.67 2004/04/19 17:42:58 momjian Exp $
16+
*$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.68 2004/05/06 19:23:25 momjian Exp $
1717
* ----------
1818
*/
1919
#include"postgres.h"
@@ -485,11 +485,10 @@ pgstat_forkexec(STATS_PROCESS_TYPE procType)
485485
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%d",MaxBackends);
486486

487487
/* + the pstat file names, and postgres pathname */
488-
/* FIXME: [fork/exec] whitespaces in directories? */
489-
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_tmpfname);
490-
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_fname);
491-
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pg_pathname);
492-
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",DataDir);
488+
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_tmpfname);
489+
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_fname);
490+
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pg_pathname);
491+
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
493492

494493
/* Add to the arg list */
495494
Assert(bufc <=lengthof(pgstatBuf));

‎src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.381 2004/04/19 17:42:58 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.382 2004/05/06 19:23:25 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -2741,8 +2741,7 @@ Backend_forkexec(Port *port)
27412741

27422742
/* Format up context to pass to exec'd process */
27432743
snprintf(buf[bufc++],MAXPGPATH,"%lu",tmpBackendFileNum);
2744-
/* FIXME: [fork/exec] whitespaces in directories? */
2745-
snprintf(buf[bufc++],MAXPGPATH,"%s",DataDir);
2744+
snprintf(buf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
27462745

27472746
/* Add to the arg list */
27482747
Assert(bufc <=lengthof(buf));
@@ -3039,6 +3038,7 @@ SSDataBase(int xlop)
30393038
#endif
30403039
#else
30413040
charidbuf[32];
3041+
charddirbuf[MAXPGPATH];
30423042
#endif
30433043

30443044
fflush(stdout);
@@ -3097,8 +3097,9 @@ SSDataBase(int xlop)
30973097

30983098
#ifdefEXEC_BACKEND
30993099
/* pass data dir before end of secure switches (-p) */
3100+
snprintf(ddirbuf,MAXPGPATH,"\"%s\"",DataDir);
31003101
av[ac++]="-D";
3101-
av[ac++]=DataDir;
3102+
av[ac++]=ddirbuf;
31023103

31033104
/* and the backend identifier + dbname */
31043105
snprintf(idbuf,sizeof(idbuf),"-p%lu,template1",tmpBackendFileNum);
@@ -3490,7 +3491,7 @@ pid_t win32_forkexec(const char* path, char *argv[])
34903491
HANDLEwaiterThread;
34913492

34923493
/* Format the cmd line */
3493-
snprintf(cmdLine,sizeof(cmdLine),"%s",path);
3494+
snprintf(cmdLine,sizeof(cmdLine),"\"%s\"",path);
34943495
i=0;
34953496
while (argv[++i]!=NULL)
34963497
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp