diff options
Diffstat (limited to 'src/bin/initdb')
| -rw-r--r-- | src/bin/initdb/initdb.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 94151acb48..71248ee1bc 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1293,7 +1293,12 @@ setup_config(void) snprintf(path, sizeof(path), "%s/postgresql.conf", pg_data); writefile(path, conflines); - chmod(path, S_IRUSR | S_IWUSR); + if (chmod(path, S_IRUSR | S_IWUSR) != 0) + { + fprintf(stderr, _("%s: could not change permissions of \"%s\": %s\n"), + progname, path, strerror(errno)); + exit_nicely(); + } /* * create the automatic configuration file to store the configuration @@ -1308,7 +1313,12 @@ setup_config(void) sprintf(path, "%s/%s", pg_data, PG_AUTOCONF_FILENAME); writefile(path, autoconflines); - chmod(path, S_IRUSR | S_IWUSR); + if (chmod(path, S_IRUSR | S_IWUSR) != 0) + { + fprintf(stderr, _("%s: could not change permissions of \"%s\": %s\n"), + progname, path, strerror(errno)); + exit_nicely(); + } free(conflines); @@ -1387,7 +1397,12 @@ setup_config(void) snprintf(path, sizeof(path), "%s/pg_hba.conf", pg_data); writefile(path, conflines); - chmod(path, S_IRUSR | S_IWUSR); + if (chmod(path, S_IRUSR | S_IWUSR) != 0) + { + fprintf(stderr, _("%s: could not change permissions of \"%s\": %s\n"), + progname, path, strerror(errno)); + exit_nicely(); + } free(conflines); @@ -1398,7 +1413,12 @@ setup_config(void) snprintf(path, sizeof(path), "%s/pg_ident.conf", pg_data); writefile(path, conflines); - chmod(path, S_IRUSR | S_IWUSR); + if (chmod(path, S_IRUSR | S_IWUSR) != 0) + { + fprintf(stderr, _("%s: could not change permissions of \"%s\": %s\n"), + progname, path, strerror(errno)); + exit_nicely(); + } free(conflines); @@ -1957,8 +1977,14 @@ setup_collation(void) * only, so this doesn't clash with "en_US" for LATIN1, say. */ if (normalize_locale_name(alias, localebuf)) + { + char *quoted_alias = escape_quotes(alias); + PG_CMD_PRINTF3("INSERT INTO tmp_pg_collation VALUES (E'%s', E'%s', %d);\n", - escape_quotes(alias), quoted_locale, enc); + quoted_alias, quoted_locale, enc); + free(quoted_alias); + } + free(quoted_locale); } /* Add an SQL-standard name */ |
