Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40cfe86

Browse files
committed
Enforce translation mode for Windows frontends to text with open/fopen
Allowing frontends to use concurrent-safe open() and fopen() via0ba06e0has the side-effect of switching the default translation mode from textto binary, so the switch can cause breakages for frontend tools when thecaller of those new versions specifies neither binary and text. Thiscommit makes sure to maintain strict compatibility with past versions,so as no frontends should see a difference when upgrading.Author: Laurenz AlbeReviewed-by: Michael Paquier, Tom LaneDiscussion:https://postgr.es/m/20180917140202.GF31460@paquier.xyz
1 parent0d38e4e commit40cfe86

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/port/open.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ pgwin32_open(const char *fileName, int fileFlags,...)
7171
_O_SHORT_LIVED |O_DSYNC |O_DIRECT |
7272
(O_CREAT |O_TRUNC |O_EXCL) | (O_TEXT |O_BINARY)))==fileFlags);
7373

74+
#ifdefFRONTEND
75+
76+
/*
77+
* Since PostgreSQL 12, those concurrent-safe versions of open() and
78+
* fopen() can be used by frontends, having as side-effect to switch the
79+
* file-translation mode from O_TEXT to O_BINARY if none is specified.
80+
* Caller may want to enforce the binary or text mode, but if nothing is
81+
* defined make sure that the default mode maps with what versions older
82+
* than 12 have been doing.
83+
*/
84+
if ((fileFlags&O_BINARY)==0)
85+
fileFlags |=O_TEXT;
86+
#endif
87+
7488
sa.nLength=sizeof(sa);
7589
sa.bInheritHandle= TRUE;
7690
sa.lpSecurityDescriptor=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp