mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
Prevent compiler truncation warnings
This commit is contained in:
@@ -1898,8 +1898,8 @@ _do_node_archive_config(void)
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
int config_file_len = strlen(runtime_options.config_files);
|
int config_file_len = strlen(runtime_options.config_files);
|
||||||
|
|
||||||
char filenamebuf[MAXLEN] = "";
|
char filenamebuf[MAXPGPATH] = "";
|
||||||
char pathbuf[MAXPGPATH] = "";
|
PQExpBufferData pathbuf;
|
||||||
|
|
||||||
for (j = 0; j < config_file_len; j++)
|
for (j = 0; j < config_file_len; j++)
|
||||||
{
|
{
|
||||||
@@ -1907,23 +1907,24 @@ _do_node_archive_config(void)
|
|||||||
{
|
{
|
||||||
int filename_len = j - i;
|
int filename_len = j - i;
|
||||||
|
|
||||||
if (filename_len > MAXLEN)
|
if (filename_len > MAXPGPATH)
|
||||||
filename_len = MAXLEN - 1;
|
filename_len = MAXPGPATH - 1;
|
||||||
|
|
||||||
strncpy(filenamebuf, runtime_options.config_files + i, filename_len);
|
strncpy(filenamebuf, runtime_options.config_files + i, filename_len);
|
||||||
|
|
||||||
filenamebuf[filename_len] = '\0';
|
filenamebuf[filename_len] = '\0';
|
||||||
|
|
||||||
snprintf(pathbuf, MAXPGPATH,
|
initPQExpBuffer(&pathbuf);
|
||||||
"%s/%s",
|
|
||||||
config_file_options.data_directory,
|
|
||||||
filenamebuf);
|
|
||||||
|
|
||||||
key_value_list_set(
|
appendPQExpBuffer(&pathbuf,
|
||||||
&config_files,
|
"%s/%s",
|
||||||
|
config_file_options.data_directory,
|
||||||
|
filenamebuf);
|
||||||
|
|
||||||
|
key_value_list_set(&config_files,
|
||||||
filenamebuf,
|
filenamebuf,
|
||||||
pathbuf);
|
pathbuf.data);
|
||||||
|
termPQExpBuffer(&pathbuf);
|
||||||
i = j + 1;
|
i = j + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1931,14 +1932,17 @@ _do_node_archive_config(void)
|
|||||||
if (i < config_file_len)
|
if (i < config_file_len)
|
||||||
{
|
{
|
||||||
strncpy(filenamebuf, runtime_options.config_files + i, config_file_len - i);
|
strncpy(filenamebuf, runtime_options.config_files + i, config_file_len - i);
|
||||||
snprintf(pathbuf, MAXPGPATH,
|
|
||||||
"%s/%s",
|
initPQExpBuffer(&pathbuf);
|
||||||
config_file_options.data_directory,
|
appendPQExpBuffer(&pathbuf,
|
||||||
filenamebuf);
|
"%s/%s",
|
||||||
key_value_list_set(
|
config_file_options.data_directory,
|
||||||
&config_files,
|
filenamebuf);
|
||||||
|
|
||||||
|
key_value_list_set(&config_files,
|
||||||
filenamebuf,
|
filenamebuf,
|
||||||
pathbuf);
|
pathbuf.data);
|
||||||
|
termPQExpBuffer(&pathbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user