diff options
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index a586c4175a3..fb948b72579 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -5026,6 +5026,10 @@ SubPostmasterMain(int argc, char *argv[]) } if (strcmp(argv[1], "--forkaux") == 0) { + AuxProcType auxtype; + + Assert(argc == 4); + /* Restore basic shared memory pointers */ InitShmemAccess(UsedShmemSegAddr); @@ -5035,7 +5039,8 @@ SubPostmasterMain(int argc, char *argv[]) /* Attach process to shared data structures */ CreateSharedMemoryAndSemaphores(); - AuxiliaryProcessMain(argc - 2, argv + 2); /* does not return */ + auxtype = atoi(argv[3]); + AuxiliaryProcessMain(auxtype); /* does not return */ } if (strcmp(argv[1], "--forkavlauncher") == 0) { @@ -5414,28 +5419,28 @@ static pid_t StartChildProcess(AuxProcType type) { pid_t pid; - char *av[10]; - int ac = 0; - char typebuf[32]; - - /* - * Set up command-line arguments for subprocess - */ - av[ac++] = "postgres"; #ifdef EXEC_BACKEND - av[ac++] = "--forkaux"; - av[ac++] = NULL; /* filled in by postmaster_forkexec */ -#endif + { + char *av[10]; + int ac = 0; + char typebuf[32]; - snprintf(typebuf, sizeof(typebuf), "-x%d", type); - av[ac++] = typebuf; + /* + * Set up command-line arguments for subprocess + */ + av[ac++] = "postgres"; + av[ac++] = "--forkaux"; + av[ac++] = NULL; /* filled in by postmaster_forkexec */ - av[ac] = NULL; - Assert(ac < lengthof(av)); + snprintf(typebuf, sizeof(typebuf), "%d", type); + av[ac++] = typebuf; -#ifdef EXEC_BACKEND - pid = postmaster_forkexec(ac, av); + av[ac] = NULL; + Assert(ac < lengthof(av)); + + pid = postmaster_forkexec(ac, av); + } #else /* !EXEC_BACKEND */ pid = fork_process(); @@ -5451,7 +5456,7 @@ StartChildProcess(AuxProcType type) MemoryContextDelete(PostmasterContext); PostmasterContext = NULL; - AuxiliaryProcessMain(ac, av); /* does not return */ + AuxiliaryProcessMain(type); /* does not return */ } #endif /* EXEC_BACKEND */ |