aboutsummaryrefslogtreecommitdiff
path: root/src/backend/libpq
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/libpq')
-rw-r--r--src/backend/libpq/be-fsstubs.c10
-rw-r--r--src/backend/libpq/crypt.c6
-rw-r--r--src/backend/libpq/hba.c14
-rw-r--r--src/backend/libpq/password.c6
-rw-r--r--src/backend/libpq/pqcomm.c10
5 files changed, 41 insertions, 5 deletions
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index b35eba81ca0..0e6bd7f5228 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.26 1998/09/01 04:28:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.27 1999/01/17 06:18:24 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -267,7 +267,11 @@ lo_import(text *filename)
* open the file to be read in
*/
StrNCpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ + 1);
+#ifndef __CYGWIN32__
fd = open(fnamebuf, O_RDONLY, 0666);
+#else
+ fd = open(fnamebuf, O_RDONLY | O_BINARY, 0666);
+#endif
if (fd < 0)
{ /* error */
elog(ERROR, "be_lo_import: can't open unix file\"%s\"\n",
@@ -341,7 +345,11 @@ lo_export(Oid lobjId, text *filename)
*/
oumask = umask((mode_t) 0);
StrNCpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ + 1);
+#ifndef __CYGWIN32__
fd = open(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+#else
+ fd = open(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
+#endif
umask(oumask);
if (fd < 0)
{ /* error */
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index 92f70c5acb9..fb87280299f 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -9,7 +9,7 @@
* Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed.
*
- * $Id: crypt.c,v 1.13 1998/12/14 06:50:24 scrappy Exp $
+ * $Id: crypt.c,v 1.14 1999/01/17 06:18:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -76,7 +76,11 @@ crypt_openpwdfile()
FILE *pwdfile;
filename = crypt_getpwdfilename();
+#ifndef __CYGWIN32__
pwdfile = AllocateFile(filename, "r");
+#else
+ pwdfile = AllocateFile(filename, "rb");
+#endif
return pwdfile;
}
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index daa4716e30b..c5be35f82bf 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -5,7 +5,7 @@
* wherein you authenticate a user by seeing what IP address the system
* says he comes from and possibly using ident).
*
- * $Id: hba.c,v 1.37 1998/12/14 06:50:25 scrappy Exp $
+ * $Id: hba.c,v 1.38 1999/01/17 06:18:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -390,7 +390,11 @@ find_hba_entry(SockAddr *raddr, const char *user, const char *database,
old_conf_file = (char *) palloc(bufsize);
snprintf(old_conf_file, bufsize, "%s/%s", DataDir, OLD_CONF_FILE);
+#ifndef __CYGWIN32__
if ((fd = open(old_conf_file, O_RDONLY, 0)) != -1)
+#else
+ if ((fd = open(old_conf_file, O_RDONLY | O_BINARY, 0)) != -1)
+#endif
{
/* Old config file exists. Tell this guy he needs to upgrade. */
close(fd);
@@ -801,7 +805,11 @@ verify_against_usermap(const char *pguser,
map_file = (char *) palloc(bufsize);
snprintf(map_file, bufsize, "%s/%s", DataDir, MAP_FILE);
+#ifndef __CYGWIN32__
file = AllocateFile(map_file, "r");
+#else
+ file = AllocateFile(map_file, "rb");
+#endif
if (file == NULL)
{
/* The open of the map file failed. */
@@ -973,7 +981,11 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
bufsize = (strlen(DataDir) + strlen(CHARSET_FILE) + 2) * sizeof(char);
map_file = (char *) palloc(bufsize);
snprintf(map_file, bufsize, "%s/%s", DataDir, CHARSET_FILE);
+#ifndef __CYGWIN32__
file = fopen(map_file, "r");
+#else
+ file = fopen(map_file, "rb");
+#endif
if (file == NULL)
{
return;
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index e6c1d816a8b..968ba055e67 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: password.c,v 1.19 1998/12/14 06:50:26 scrappy Exp $
+ * $Id: password.c,v 1.20 1999/01/17 06:18:26 momjian Exp $
*
*/
@@ -27,7 +27,11 @@ verify_password(char *auth_arg, char *user, char *password)
strcat(pw_file_fullname, "/");
strcat(pw_file_fullname, auth_arg);
+#ifndef __CYGWIN32__
pw_file = AllocateFile(pw_file_fullname, "r");
+#else
+ pw_file = AllocateFile(pw_file_fullname, "rb");
+#endif
if (!pw_file)
{
snprintf(PQerrormsg, ERROR_MSG_LENGTH,
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index c8de26e8d5b..8f9c14fee9f 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.62 1999/01/17 03:10:23 tgl Exp $
+ * $Id: pqcomm.c,v 1.63 1999/01/17 06:18:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -466,7 +466,11 @@ StreamServerPort(char *hostName, short portName, int *fdP)
* can safely delete the file.
*/
#ifdef HAVE_FCNTL_SETLK
+#ifndef __CYGWIN32__
if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
+#else
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | O_BINARY, 0666)) >= 0)
+#endif
{
struct flock lck;
@@ -519,7 +523,11 @@ StreamServerPort(char *hostName, short portName, int *fdP)
* lock_fd is left open to keep the lock.
*/
#ifdef HAVE_FCNTL_SETLK
+#ifndef __CYGWIN32__
if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
+#else
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | O_BINARY, 0666)) >= 0)
+#endif
{
struct flock lck;