diff options
Diffstat (limited to 'src/bin/pg_ctl/pg_ctl.c')
-rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 1f921819c23..fc87e7d76ed 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -2034,9 +2034,11 @@ adjust_data_dir(void) else my_exec_path = pg_strdup(exec_path); - snprintf(cmd, MAXPGPATH, SYSTEMQUOTE "\"%s\" %s%s -C data_directory" SYSTEMQUOTE, - my_exec_path, pgdata_opt ? pgdata_opt : "", post_opts ? - post_opts : ""); + /* it's important for -C to be the first option, see main.c */ + snprintf(cmd, MAXPGPATH, SYSTEMQUOTE "\"%s\" -C data_directory %s%s" SYSTEMQUOTE, + my_exec_path, + pgdata_opt ? pgdata_opt : "", + post_opts ? post_opts : ""); fd = popen(cmd, "r"); if (fd == NULL || fgets(filename, sizeof(filename), fd) == NULL) |