Use appendPQExpBufferStr where appropriate

This commit is contained in:
Ian Barwick
2019-08-13 16:31:55 +09:00
parent d0f5ee1851
commit c0f3990973

View File

@@ -3016,19 +3016,19 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
if (*config_file_options.rsync_options == '\0')
{
appendPQExpBuffer(&rsync_flags, "%s",
"--archive --checksum --compress --progress --rsh=ssh");
appendPQExpBufferStr(&rsync_flags,
"--archive --checksum --compress --progress --rsh=ssh");
}
else
{
appendPQExpBuffer(&rsync_flags, "%s",
config_file_options.rsync_options);
appendPQExpBufferStr(&rsync_flags,
config_file_options.rsync_options);
}
if (runtime_options.force)
{
appendPQExpBuffer(&rsync_flags, "%s",
" --delete --checksum");
appendPQExpBufferStr(&rsync_flags,
" --delete --checksum");
}
if (!remote_user[0])
@@ -3054,11 +3054,11 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
if (is_directory)
{
/* Files which we don't want */
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=postmaster.pid --exclude=postmaster.opts --exclude=global/pg_control");
appendPQExpBufferStr(&rsync_flags,
" --exclude=postmaster.pid --exclude=postmaster.opts --exclude=global/pg_control");
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=recovery.conf --exclude=recovery.done");
appendPQExpBufferStr(&rsync_flags,
" --exclude=recovery.conf --exclude=recovery.done");
if (server_version_num >= 90400)
{
@@ -3066,8 +3066,8 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
* Ideally we'd use PG_AUTOCONF_FILENAME from utils/guc.h, but
* that has too many dependencies for a mere client program.
*/
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=postgresql.auto.conf.tmp");
appendPQExpBufferStr(&rsync_flags,
" --exclude=postgresql.auto.conf.tmp");
}
/* Temporary files which we don't want, if they exist */
@@ -3078,17 +3078,17 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
if (server_version_num >= 100000)
{
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=pg_wal/*");
appendPQExpBufferStr(&rsync_flags,
" --exclude=pg_wal/*");
}
else
{
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=pg_xlog/*");
appendPQExpBufferStr(&rsync_flags,
" --exclude=pg_xlog/*");
}
appendPQExpBuffer(&rsync_flags, "%s",
" --exclude=pg_log/* --exclude=pg_stat_tmp/*");
appendPQExpBufferStr(&rsync_flags,
" --exclude=pg_log/* --exclude=pg_stat_tmp/*");
maxlen_snprintf(script, "rsync %s %s:%s/* %s",
rsync_flags.data, host_string, remote_path, local_path);