Skip to content

Commit

Permalink
win,fs: don't modify global file translation mode
Browse files Browse the repository at this point in the history
The MSVC runtime provides a global variable that can be used to set the
default file translation mode so that file open calls don't need to
explicitly specify that mode.

libuv was changing that global mode to binary from its default of text.
However, libuv doesn't actually need to do that anymore, and the
application may not want the default changed under it. This change stops
libuv from modifying that global mode.

PR-URL: #2324
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
jblazquez authored and bnoordhuis committed Jul 2, 2019
1 parent 6052607 commit f9adfb2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
3 changes: 0 additions & 3 deletions src/win/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ static void uv_init(void) {
/* Initialize winsock */
uv_winsock_init();

/* Initialize FS */
uv_fs_init();

/* Initialize signal stuff */
uv_signals_init();

Expand Down
4 changes: 0 additions & 4 deletions src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ const WCHAR UNC_PATH_PREFIX_LEN = 8;

static int uv__file_symlink_usermode_flag = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;

void uv_fs_init(void) {
_fmode = _O_BINARY;
}


INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
const char* new_path, const int copy_path) {
Expand Down
6 changes: 0 additions & 6 deletions src/win/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle);
int uv_translate_sys_error(int sys_errno);


/*
* FS
*/
void uv_fs_init(void);


/*
* FS Event
*/
Expand Down
1 change: 1 addition & 0 deletions test/runner-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ int platform_init(int argc, char **argv) {
_setmode(0, _O_BINARY);
_setmode(1, _O_BINARY);
_setmode(2, _O_BINARY);
_set_fmode(_O_BINARY);

/* Disable stdio output buffering. */
setvbuf(stdout, NULL, _IONBF, 0);
Expand Down

0 comments on commit f9adfb2

Please sign in to comment.