summaryrefslogtreecommitdiff
path: root/src/backend/libpq
diff options
context:
space:
mode:
authorBruce Momjian2000-06-02 15:57:44 +0000
committerBruce Momjian2000-06-02 15:57:44 +0000
commitcc2b5e5815aa596dbbdd288d0d178019f2d521aa (patch)
treeb82baecdde9295a977c530b10f8f15a91e012cda /src/backend/libpq
parentbf1c8f2b3b067c29f1abdf6fe866fb485ade96e9 (diff)
Remove NT-specific file open defines by defining our own open macros for
"rb" and "wb".
Diffstat (limited to 'src/backend/libpq')
-rw-r--r--src/backend/libpq/be-fsstubs.c14
-rw-r--r--src/backend/libpq/crypt.c8
-rw-r--r--src/backend/libpq/hba.c20
-rw-r--r--src/backend/libpq/password.c8
-rw-r--r--src/backend/libpq/pqcomm.c14
5 files changed, 14 insertions, 50 deletions
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index 1ac73fa0ea4..c41ed08bd7d 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.44 2000/04/12 17:15:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.45 2000/06/02 15:57:20 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -342,11 +342,7 @@ lo_import(text *filename)
if (nbytes > FNAME_BUFSIZE)
nbytes = FNAME_BUFSIZE;
StrNCpy(fnamebuf, VARDATA(filename), nbytes);
-#ifndef __CYGWIN32__
- fd = PathNameOpenFile(fnamebuf, O_RDONLY, 0666);
-#else
- fd = PathNameOpenFile(fnamebuf, O_RDONLY | O_BINARY, 0666);
-#endif
+ fd = PathNameOpenFile(fnamebuf, O_RDONLY | PG_BINARY, 0666);
if (fd < 0)
{ /* error */
elog(ERROR, "lo_import: can't open unix file \"%s\": %m",
@@ -427,11 +423,7 @@ lo_export(Oid lobjId, text *filename)
nbytes = FNAME_BUFSIZE;
StrNCpy(fnamebuf, VARDATA(filename), nbytes);
oumask = umask((mode_t) 0022);
-#ifndef __CYGWIN32__
- fd = PathNameOpenFile(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC, 0666);
-#else
- fd = PathNameOpenFile(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
-#endif
+ fd = PathNameOpenFile(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC | PG_BINARY, 0666);
umask(oumask);
if (fd < 0)
{ /* error */
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index 7c3bd35e243..ce084b1a60e 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.23 1999/07/17 20:17:01 momjian Exp $
+ * $Id: crypt.c,v 1.24 2000/06/02 15:57:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,11 +73,7 @@ crypt_openpwdfile()
FILE *pwdfile;
filename = crypt_getpwdfilename();
-#ifndef __CYGWIN32__
- pwdfile = AllocateFile(filename, "r");
-#else
- pwdfile = AllocateFile(filename, "rb");
-#endif
+ pwdfile = AllocateFile(filename, PG_BINARY_R);
return pwdfile;
}
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 2bdf5fbf4b4..61c6b9f4361 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.51 2000/04/12 17:15:14 momjian Exp $
+ * $Id: hba.c,v 1.52 2000/06/02 15:57:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -397,11 +397,7 @@ find_hba_entry(hbaPort *port, bool *hba_ok_p)
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
+ if ((fd = open(old_conf_file, O_RDONLY | PG_BINARY, 0)) != -1)
{
/* Old config file exists. Tell this guy he needs to upgrade. */
close(fd);
@@ -810,11 +806,7 @@ verify_against_usermap(const char *pguser,
map_file = (char *) palloc(bufsize);
snprintf(map_file, bufsize, "%s/%s", DataDir, USERMAP_FILE);
-#ifndef __CYGWIN32__
- file = AllocateFile(map_file, "r");
-#else
- file = AllocateFile(map_file, "rb");
-#endif
+ file = AllocateFile(map_file, PG_BINARY_R);
if (file == NULL)
{
/* The open of the map file failed. */
@@ -986,11 +978,7 @@ 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 = AllocateFile(map_file, "r");
-#else
- file = AllocateFile(map_file, "rb");
-#endif
+ file = AllocateFile(map_file, PG_BINARY_R);
if (file == NULL)
return;
while (!eof)
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index 9fc715a9a28..c7656f8b98f 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -2,7 +2,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: password.c,v 1.28 2000/01/26 05:56:29 momjian Exp $
+ * $Id: password.c,v 1.29 2000/06/02 15:57:21 momjian Exp $
*
*/
@@ -28,11 +28,7 @@ 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
+ pw_file = AllocateFile(pw_file_fullname, PG_BINARY_R);
if (!pw_file)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index f4fb1917009..44c1dd91a01 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.93 2000/05/31 00:28:18 petere Exp $
+ * $Id: pqcomm.c,v 1.94 2000/06/02 15:57:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -234,11 +234,7 @@ StreamServerPort(char *hostName, unsigned 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
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | PG_BINARY, 0666)) >= 0)
{
struct flock lck;
@@ -287,11 +283,7 @@ StreamServerPort(char *hostName, unsigned 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
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | PG_BINARY, 0666)) >= 0)
{
struct flock lck;