}
/*
- * Writes updated configuration parameter values into
- * postgresql.auto.conf.temp file. It traverses the list of parameters
- * and quote the string values before writing them to temporaray file.
+ * Write updated configuration parameter values into a temporary file.
+ * This function traverses the list of parameters and quotes the string
+ * values before writing them.
*/
static void
write_auto_conf_file(int fd, const char *filename, ConfigVariable **head_p)
StringInfoData buf;
initStringInfo(&buf);
- appendStringInfoString(&buf, "# Do not edit this file manually! \n");
- appendStringInfoString(&buf, "# It will be overwritten by ALTER SYSTEM command. \n");
+ appendStringInfoString(&buf, "# Do not edit this file manually!\n");
+ appendStringInfoString(&buf, "# It will be overwritten by ALTER SYSTEM command.\n");
/*
* write the file header message before contents, so that if there is no
/*
* This function takes list of all configuration parameters in
- * postgresql.auto.conf and parameter to be updated as input arguments and
+ * PG_AUTOCONF_FILENAME and parameter to be updated as input arguments and
* replace the updated configuration parameter value in a list. If the
* parameter to be updated is new then it is appended to the list of
* parameters.
* and write them all to the automatic configuration file.
*
* The configuration parameters are written to a temporary
- * file then renamed to the final name. The template for the
- * temporary file is postgresql.auto.conf.temp.
+ * file then renamed to the final name.
*
* An LWLock is used to serialize writing to the same file.
*
* In case of an error, we leave the original automatic
- * configuration file (postgresql.auto.conf) intact.
+ * configuration file (PG_AUTOCONF_FILENAME) intact.
*/
void
AlterSystemSetConfigFile(AlterSystemStmt * altersysstmt)
/*
- * Use data directory as reference path for postgresql.auto.conf and it's
- * corresponding temp file
+ * Use data directory as reference path for PG_AUTOCONF_FILENAME and its
+ * corresponding temporary file.
*/
join_path_components(AutoConfFileName, data_directory, PG_AUTOCONF_FILENAME);
canonicalize_path(AutoConfFileName);
"temp");
/*
- * one backend is allowed to operate on postgresql.auto.conf file, to
+ * One backend is allowed to operate on file PG_AUTOCONF_FILENAME, to
* ensure that we need to update the contents of the file with
* AutoFileLock. To ensure crash safety, first the contents are written to
- * temporary file and then rename it to postgresql.auto.conf. In case
+ * a temporary file which is then renameed to PG_AUTOCONF_FILENAME. In case
* there exists a temp file from previous crash, that can be reused.
*/
{
if (stat(AutoConfFileName, &st) == 0)
{
- /* open postgresql.auto.conf file */
+ /* open file PG_AUTOCONF_FILENAME */
infile = AllocateFile(AutoConfFileName, "r");
if (infile == NULL)
ereport(ERROR,
(errmsg("failed to open auto conf file \"%s\": %m ",
AutoConfFileName)));
- /* Parse the postgresql.auto.conf file */
+ /* parse it */
ParseConfigFp(infile, AutoConfFileName, 0, LOG, &head, &tail);
FreeFile(infile);
*/
replace_auto_config_value(&head, &tail, AutoConfFileName, name, value);
- /* Write and sync the New contents to postgresql.auto.conf.temp file */
+ /* Write and sync the new contents to the temporary file */
write_auto_conf_file(Tmpfd, AutoConfTmpFileName, &head);
close(Tmpfd);