1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2026-06-21 01:34:15 +02:00

Merge branch 'master' into issue_339

This commit is contained in:
Grigory Smolkin
2021-03-05 17:05:06 +03:00
+16 -3
View File
@@ -299,6 +299,7 @@ do_set_config(bool missing_ok)
for (i = 0; instance_options[i].type; i++)
{
int rc = 0;
ConfigOption *opt = &instance_options[i];
char *value;
@@ -319,13 +320,25 @@ do_set_config(bool missing_ok)
}
if (strchr(value, ' '))
fprintf(fp, "%s = '%s'\n", opt->lname, value);
rc = fprintf(fp, "%s = '%s'\n", opt->lname, value);
else
fprintf(fp, "%s = %s\n", opt->lname, value);
rc = fprintf(fp, "%s = %s\n", opt->lname, value);
if (rc < 0)
elog(ERROR, "Cannot write to configuration file: \"%s\"", path_temp);
pfree(value);
}
fclose(fp);
if (ferror(fp) || fflush(fp))
elog(ERROR, "Cannot write to configuration file: \"%s\"", path_temp);
if (fclose(fp))
elog(ERROR, "Cannot close configuration file: \"%s\"", path_temp);
if (fio_sync(path_temp, FIO_LOCAL_HOST) != 0)
elog(ERROR, "Failed to sync temp configuration file \"%s\": %s",
path_temp, strerror(errno));
if (rename(path_temp, path) < 0)
{