1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Remove NT-specific file open defines by defining our own open macros for

"rb" and "wb".
This commit is contained in:
Bruce Momjian
2000-06-02 15:57:44 +00:00
parent bf1c8f2b3b
commit cc2b5e5815
28 changed files with 590 additions and 348 deletions

View File

@@ -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 */

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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,

View File

@@ -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;