diff options
Diffstat (limited to 'src/bin/pg_rewind/pg_rewind.c')
-rw-r--r-- | src/bin/pg_rewind/pg_rewind.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 57a168fea2d..bde90bf60bb 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -1055,8 +1055,7 @@ static void getRestoreCommand(const char *argv0) { int rc; - char postgres_exec_path[MAXPGPATH], - cmd_output[MAXPGPATH]; + char postgres_exec_path[MAXPGPATH]; PQExpBuffer postgres_cmd; if (!restore_wal) @@ -1105,16 +1104,15 @@ getRestoreCommand(const char *argv0) /* add -C switch, for restore_command */ appendPQExpBufferStr(postgres_cmd, " -C restore_command"); - if (!pipe_read_line(postgres_cmd->data, cmd_output, sizeof(cmd_output))) - exit(1); + restore_command = pipe_read_line(postgres_cmd->data); + if (restore_command == NULL) + pg_fatal("unable to read restore_command from target cluster"); - (void) pg_strip_crlf(cmd_output); + (void) pg_strip_crlf(restore_command); - if (strcmp(cmd_output, "") == 0) + if (strcmp(restore_command, "") == 0) pg_fatal("restore_command is not set in the target cluster"); - restore_command = pg_strdup(cmd_output); - pg_log_debug("using for rewind restore_command = \'%s\'", restore_command); |