summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-24 15:55:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-24 15:55:29 +0000
commit85b2facdd846917c2b15e396c7056ffead58bbff (patch)
treeb620fa0cac2d59e9a4493205987e4ec2bdca035e
parent15db03181a030fefb74b772f7cf6b38a345a723d (diff)
downloadpostgresql-85b2facdd846917c2b15e396c7056ffead58bbff.tar.gz
Write config files as text not binary, per Magnus Hagander.
-rw-r--r--src/bin/initdb/initdb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index b088604447..d9d8e0d480 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.64 2004/10/22 22:30:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.65 2004/10/24 15:55:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -407,6 +407,9 @@ readfile(char *path)
/*
* write an array of lines to a file
+ *
+ * This is only used to write text files. Use fopen "w" not PG_BINARY_W
+ * so that the resulting configuration files are nicely editable on Windows.
*/
static void
writefile(char *path, char **lines)
@@ -414,7 +417,7 @@ writefile(char *path, char **lines)
FILE *out_file;
char **line;
- if ((out_file = fopen(path, PG_BINARY_W)) == NULL)
+ if ((out_file = fopen(path, "w")) == NULL)
{
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
progname, path, strerror(errno));