mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Miscellaneous string handling cleanup
This is mainly to prevent effectively spurious truncation warnings in recent GCC versions.
This commit is contained in:
15
configfile.c
15
configfile.c
@@ -836,15 +836,16 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
|
|||||||
conninfo_options = PQconninfoParse(options->conninfo, &conninfo_errmsg);
|
conninfo_options = PQconninfoParse(options->conninfo, &conninfo_errmsg);
|
||||||
if (conninfo_options == NULL)
|
if (conninfo_options == NULL)
|
||||||
{
|
{
|
||||||
char error_message_buf[MAXLEN] = "";
|
PQExpBufferData error_message_buf;
|
||||||
|
initPQExpBuffer(&error_message_buf);
|
||||||
|
|
||||||
snprintf(error_message_buf,
|
appendPQExpBuffer(&error_message_buf,
|
||||||
MAXLEN,
|
_("\"conninfo\": %s (provided: \"%s\")"),
|
||||||
_("\"conninfo\": %s (provided: \"%s\")"),
|
conninfo_errmsg,
|
||||||
conninfo_errmsg,
|
options->conninfo);
|
||||||
options->conninfo);
|
|
||||||
|
|
||||||
item_list_append(error_list, error_message_buf);
|
item_list_append(error_list, error_message_buf.data);
|
||||||
|
termPQExpBuffer(&error_message_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
PQconninfoFree(conninfo_options);
|
PQconninfoFree(conninfo_options);
|
||||||
|
|||||||
@@ -1521,10 +1521,10 @@ get_ready_archive_files(PGconn *conn, const char *data_directory)
|
|||||||
while ((arcdir_ent = readdir(arcdir)) != NULL)
|
while ((arcdir_ent = readdir(arcdir)) != NULL)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
char file_path[MAXPGPATH] = "";
|
char file_path[MAXPGPATH + sizeof(arcdir_ent->d_name)];
|
||||||
int basenamelen = 0;
|
int basenamelen = 0;
|
||||||
|
|
||||||
snprintf(file_path, MAXPGPATH,
|
snprintf(file_path, sizeof(file_path),
|
||||||
"%s/%s",
|
"%s/%s",
|
||||||
archive_status_dir,
|
archive_status_dir,
|
||||||
arcdir_ent->d_name);
|
arcdir_ent->d_name);
|
||||||
|
|||||||
@@ -906,7 +906,7 @@ _do_create_recovery_conf(void)
|
|||||||
t_node_info upstream_node_record = T_NODE_INFO_INITIALIZER;
|
t_node_info upstream_node_record = T_NODE_INFO_INITIALIZER;
|
||||||
|
|
||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
char recovery_file_path[MAXPGPATH] = "";
|
char recovery_file_path[MAXPGPATH + sizeof(RECOVERY_COMMAND_FILE)] = "";
|
||||||
struct stat st;
|
struct stat st;
|
||||||
bool node_is_running = false;
|
bool node_is_running = false;
|
||||||
bool slot_creation_required = false;
|
bool slot_creation_required = false;
|
||||||
@@ -1151,7 +1151,10 @@ _do_create_recovery_conf(void)
|
|||||||
|
|
||||||
/* check if recovery.conf exists */
|
/* check if recovery.conf exists */
|
||||||
|
|
||||||
snprintf(recovery_file_path, MAXPGPATH, "%s/%s", local_data_directory, RECOVERY_COMMAND_FILE);
|
snprintf(recovery_file_path, sizeof(recovery_file_path),
|
||||||
|
"%s/%s",
|
||||||
|
local_data_directory,
|
||||||
|
RECOVERY_COMMAND_FILE);
|
||||||
|
|
||||||
if (stat(recovery_file_path, &st) == -1)
|
if (stat(recovery_file_path, &st) == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user