Index: src/bin/pg_ctl/pg_ctl.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.c,v retrieving revision 1.26 diff -c -c -r1.26 pg_ctl.c *** src/bin/pg_ctl/pg_ctl.c 28 Aug 2004 21:01:38 -0000 1.26 --- src/bin/pg_ctl/pg_ctl.c 28 Aug 2004 21:57:29 -0000 *************** *** 67,72 **** --- 67,73 ---- static int sig = SIGTERM; /* default */ static CtlCommand ctl_command = NO_COMMAND; static char *pg_data = NULL; + static char *pgdata_opt = NULL; static char *post_opts = NULL; static const char *progname; static char *log_file = NULL; *************** *** 309,327 **** */ if (log_file != NULL) #ifndef WIN32 ! snprintf(cmd, MAXPGPATH, "%s\"%s\" %s < \"%s\" >> \"%s\" 2>&1 &%s", #else ! snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s < \"%s\" >> \"%s\" 2>&1%s", #endif ! SYSTEMQUOTE, postgres_path, post_opts, DEVNULL, log_file, ! SYSTEMQUOTE); else #ifndef WIN32 ! snprintf(cmd, MAXPGPATH, "%s\"%s\" %s < \"%s\" 2>&1 &%s", #else ! snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s < \"%s\" 2>&1%s", #endif ! SYSTEMQUOTE, postgres_path, post_opts, DEVNULL, SYSTEMQUOTE); return system(cmd); } --- 310,329 ---- */ if (log_file != NULL) #ifndef WIN32 ! snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s", #else ! snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s", #endif ! SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts, ! DEVNULL, log_file, SYSTEMQUOTE); else #ifndef WIN32 ! snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" 2>&1 &%s", #else ! snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s", #endif ! SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts, ! DEVNULL, SYSTEMQUOTE); return system(cmd); } *************** *** 494,499 **** --- 496,505 ---- } } + /* No -D or -D already added during server start */ + if (ctl_command == RESTART_COMMAND || pgdata_opt == NULL) + pgdata_opt = ""; + if (postgres_path == NULL) { char *postmaster_path; *************** *** 1210,1215 **** --- 1216,1224 ---- env_var = xmalloc(len + 8); snprintf(env_var, len + 8, "PGDATA=%s", optarg); putenv(env_var); + /* Show -D for easier postmaster 'ps' identification */ + pgdata_opt = xmalloc(len + 7); + snprintf(pgdata_opt, len + 7, "-D \"%s\" ", optarg); break; } case 'l':