summaryrefslogtreecommitdiff
path: root/src/bin/pg_passwd
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_passwd')
-rw-r--r--src/bin/pg_passwd/Makefile4
-rw-r--r--src/bin/pg_passwd/pg_passwd.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/bin/pg_passwd/Makefile b/src/bin/pg_passwd/Makefile
index 408640fea5..e4ceb5c713 100644
--- a/src/bin/pg_passwd/Makefile
+++ b/src/bin/pg_passwd/Makefile
@@ -15,7 +15,7 @@ pg_passwd: $(OBJS)
$(CC) -o pg_passwd $(OBJS) $(LDFLAGS)
install: pg_passwd
- $(INSTALL) $(INSTL_EXE_OPTS) pg_passwd $(BINDIR)/pg_passwd
+ $(INSTALL) $(INSTL_EXE_OPTS) pg_passwd$(X) $(BINDIR)/pg_passwd$(X)
.PHONY: submake
submake:
@@ -25,7 +25,7 @@ depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f pg_passwd $(OBJS)
+ rm -f pg_passwd$(X) $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
diff --git a/src/bin/pg_passwd/pg_passwd.c b/src/bin/pg_passwd/pg_passwd.c
index de9ffd65a7..0718a3153b 100644
--- a/src/bin/pg_passwd/pg_passwd.c
+++ b/src/bin/pg_passwd/pg_passwd.c
@@ -63,7 +63,11 @@ read_pwd_file(char *filename)
int i;
try_again:
+#ifndef __CYGWIN32__
fp = fopen(filename, "r");
+#else
+ fp = fopen(filename, "rb");
+#endif
if (fp == NULL)
{
if (errno == ENOENT)
@@ -75,7 +79,11 @@ try_again:
{
case 'y':
case 'Y':
+#ifndef __CYGWIN32__
fp = fopen(filename, "w");
+#else
+ fp = fopen(filename, "wb");
+#endif
if (fp == NULL)
{
perror(filename);
@@ -193,7 +201,11 @@ link_again:
}
/* open file */
+#ifndef __CYGWIN32__
if ((fp = fopen(filename, "w")) == NULL)
+#else
+ if ((fp = fopen(filename, "wb")) == NULL)
+#endif
{
perror(filename);
exit(1);