mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-01 07:07:21 +02:00
Revert "Allow concurrent-safe open() and fopen() in frontend code for Windows"
This reverts commit f02259fe93
, in the
v11 branch only.
The hack this required in initdb.c should probably have clued us that it
wasn't really ready, but we didn't get the hint. Subsequent developments
have made clear that it affected text-vs-binary behavior in a lot of
places, and there's no reason to think that any of those behavioral changes
are desirable. There's no time to fix this before 11beta4, so just revert
for the moment. We can keep working on this in HEAD, and maybe reconsider
a back-patch once we're satisfied things are stable.
(I take the blame for this fiasco, having encouraged Michael to back-patch
a change at the last possible moment before beta wrap.)
This commit is contained in:
parent
5c07d6497d
commit
df8b5f3eb8
@ -490,15 +490,7 @@ readfile(const char *path)
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
/*
|
|
||||||
* On Windows, we have to open the file in text mode so that carriage
|
|
||||||
* returns are stripped.
|
|
||||||
*/
|
|
||||||
if ((infile = fopen(path, "rt")) == NULL)
|
|
||||||
#else
|
|
||||||
if ((infile = fopen(path, "r")) == NULL)
|
if ((infile = fopen(path, "r")) == NULL)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
||||||
progname, path, strerror(errno));
|
progname, path, strerror(errno));
|
||||||
|
@ -287,7 +287,7 @@ FindStreamingStart(uint32 *tli)
|
|||||||
|
|
||||||
snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name);
|
snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name);
|
||||||
|
|
||||||
fd = open(fullpath, O_RDONLY | PG_BINARY, 0);
|
fd = open(fullpath, O_RDONLY | PG_BINARY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open compressed file \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not open compressed file \"%s\": %s\n"),
|
||||||
|
@ -80,7 +80,7 @@ scan_file(const char *fn, BlockNumber segmentno)
|
|||||||
int f;
|
int f;
|
||||||
BlockNumber blockno;
|
BlockNumber blockno;
|
||||||
|
|
||||||
f = open(fn, O_RDONLY | PG_BINARY, 0);
|
f = open(fn, O_RDONLY | PG_BINARY);
|
||||||
if (f < 0)
|
if (f < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
|
||||||
|
@ -222,7 +222,7 @@ pre_sync_fname(const char *fname, bool isdir, const char *progname)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = open(fname, O_RDONLY | PG_BINARY, 0);
|
fd = open(fname, O_RDONLY | PG_BINARY);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
@ -283,7 +283,7 @@ fsync_fname(const char *fname, bool isdir, const char *progname)
|
|||||||
* unsupported operations, e.g. opening a directory under Windows), and
|
* unsupported operations, e.g. opening a directory under Windows), and
|
||||||
* logging others.
|
* logging others.
|
||||||
*/
|
*/
|
||||||
fd = open(fname, flags, 0);
|
fd = open(fname, flags);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
if (errno == EACCES || (isdir && errno == EISDIR))
|
if (errno == EACCES || (isdir && errno == EISDIR))
|
||||||
|
@ -249,8 +249,11 @@ extern bool rmtree(const char *path, bool rmtopdir);
|
|||||||
#define O_DIRECT 0x80000000
|
#define O_DIRECT 0x80000000
|
||||||
extern int pgwin32_open(const char *, int,...);
|
extern int pgwin32_open(const char *, int,...);
|
||||||
extern FILE *pgwin32_fopen(const char *, const char *);
|
extern FILE *pgwin32_fopen(const char *, const char *);
|
||||||
|
|
||||||
|
#ifndef FRONTEND
|
||||||
#define open(a,b,c) pgwin32_open(a,b,c)
|
#define open(a,b,c) pgwin32_open(a,b,c)
|
||||||
#define fopen(a,b) pgwin32_fopen(a,b)
|
#define fopen(a,b) pgwin32_fopen(a,b)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want
|
* Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want
|
||||||
|
Loading…
Reference in New Issue
Block a user