1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Apply Win32 patch from Horak Daniel.

This commit is contained in:
Bruce Momjian
1999-01-17 06:20:06 +00:00
parent 298682d9e0
commit 7a6b562fdf
58 changed files with 484 additions and 86 deletions

View File

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

View File

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

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

View File

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

View File

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