Commit 24cbcb00 by Jonathan Wakely Committed by Jonathan Wakely

PR libstdc++/89562 use binary mode for file I/O

	PR libstdc++/89562
	* src/filesystem/ops-common.h (do_copy_file): Open files in binary
	mode for mingw.

From-SVN: r269356
parent de06e54d
2019-03-03 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/89562
* src/filesystem/ops-common.h (do_copy_file): Open files in binary
mode for mingw.
2019-03-01 Jonathan Wakely <jwakely@redhat.com> 2019-03-01 Jonathan Wakely <jwakely@redhat.com>
* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource) * testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource)
......
...@@ -402,7 +402,12 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM ...@@ -402,7 +402,12 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM
int fd; int fd;
}; };
CloseFD in = { posix::open(from, O_RDONLY) }; int iflag = O_RDONLY;
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
iflag |= O_BINARY;
#endif
CloseFD in = { posix::open(from, iflag) };
if (in.fd == -1) if (in.fd == -1)
{ {
ec.assign(errno, std::generic_category()); ec.assign(errno, std::generic_category());
...@@ -413,6 +418,9 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM ...@@ -413,6 +418,9 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM
oflag |= O_TRUNC; oflag |= O_TRUNC;
else else
oflag |= O_EXCL; oflag |= O_EXCL;
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
oflag |= O_BINARY;
#endif
CloseFD out = { posix::open(to, oflag, S_IWUSR) }; CloseFD out = { posix::open(to, oflag, S_IWUSR) };
if (out.fd == -1) if (out.fd == -1)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment