diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 3e6ba288..0df3001d 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -2267,7 +2267,6 @@ run_file_backup(void) char basebackups_directory[MAXLEN]; char backup_id[MAXLEN] = ""; char *p, *q; - PQExpBufferData command_output; TablespaceDataList tablespace_list = { NULL, NULL }; TablespaceDataListCell *cell_t; @@ -2361,7 +2360,7 @@ run_file_backup(void) local_repmgr_tmp_directory); (void)local_command( command, - &command_output); + NULL); /* * Get tablespace data @@ -2471,7 +2470,7 @@ run_file_backup(void) (void)local_command( command, - &command_output); + NULL); unlink(datadir_list_filename); @@ -2573,7 +2572,7 @@ run_file_backup(void) tblspc_dir_dest); (void)local_command( command, - &command_output); + NULL); fclose(cell_t->f); maxlen_snprintf(filename, "%s/%s.txt", diff --git a/repmgr-client.c b/repmgr-client.c index 32e85690..1d59f762 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -1565,31 +1565,29 @@ local_command(const char *command, PQExpBufferData *outputbuf) retval = system(command); return (retval == 0) ? true : false; } - else + + fp = popen(command, "r"); + + if (fp == NULL) { - fp = popen(command, "r"); - - if (fp == NULL) - { - log_error(_("unable to execute local command:\n%s"), command); - return false; - } - - /* TODO: better error handling */ - while (fgets(output, MAXLEN, fp) != NULL) - { - appendPQExpBuffer(outputbuf, "%s", output); - } - - pclose(fp); - - if (outputbuf->data != NULL) - log_verbose(LOG_DEBUG, "local_command(): output returned was:\n%s", outputbuf->data); - else - log_verbose(LOG_DEBUG, "local_command(): no output returned"); - - return true; + log_error(_("unable to execute local command:\n%s"), command); + return false; } + + /* TODO: better error handling */ + while (fgets(output, MAXLEN, fp) != NULL) + { + appendPQExpBuffer(outputbuf, "%s", output); + } + + pclose(fp); + + if (outputbuf->data != NULL) + log_verbose(LOG_DEBUG, "local_command(): output returned was:\n%s", outputbuf->data); + else + log_verbose(LOG_DEBUG, "local_command(): no output returned"); + + return true; }