Remove unused PQexpBuffer

It was being referenced without being initialised, but the output
which would have been placed there is not used anyway, so discard
completely.
This commit is contained in:
Ian Barwick
2017-07-18 12:00:53 +09:00
parent 2c8dd49831
commit 248525ccba
2 changed files with 24 additions and 27 deletions

View File

@@ -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",

View File

@@ -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;
}