mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Check function return values in modify_auto_conf()
This commit is contained in:
19
configfile.c
19
configfile.c
@@ -1843,10 +1843,17 @@ modify_auto_conf(const char *data_dir, KeyValueList *items)
|
||||
return false;
|
||||
}
|
||||
|
||||
// XXX check return value
|
||||
(void) ProcessPostgresConfigFile(fp, auto_conf.data, &config, NULL, NULL);
|
||||
success = ProcessPostgresConfigFile(fp, auto_conf.data, &config, NULL, NULL);
|
||||
fclose(fp);
|
||||
|
||||
if (success == false)
|
||||
{
|
||||
fprintf(stderr, "unable to process \"%s\"\n",
|
||||
auto_conf.data);
|
||||
termPQExpBuffer(&auto_conf);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append requested items to items extracted from the existing file.
|
||||
*/
|
||||
@@ -1855,7 +1862,6 @@ modify_auto_conf(const char *data_dir, KeyValueList *items)
|
||||
key_value_list_replace_or_set(&config,
|
||||
cell->key,
|
||||
cell->value);
|
||||
|
||||
}
|
||||
|
||||
initPQExpBuffer(&auto_conf_tmp);
|
||||
@@ -1911,9 +1917,12 @@ modify_auto_conf(const char *data_dir, KeyValueList *items)
|
||||
* (unlikely) event that a repmgr built against one of those versions
|
||||
* is being used against Pg 12 and later.
|
||||
*/
|
||||
// XXX check return values
|
||||
|
||||
#if (PG_ACTUAL_VERSION_NUM >= 100000)
|
||||
(void) durable_rename(auto_conf_tmp.data, auto_conf.data, LOG);
|
||||
if (durable_rename(auto_conf_tmp.data, auto_conf.data, LOG) != 0)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
#else
|
||||
if (rename(auto_conf_tmp.data, auto_conf.data) < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user