aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-16 21:46:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-05 18:23:39 +0300
commit7a8386289b18678c2ee49ffdfcf71e3a2abd3258 (patch)
tree607ecc405df2584c2c652e15e6e9528fbb0eb3a4
parent8ca3b4e5996e37411d866fb5fa1b1a86515aa628 (diff)
Fix ifdstream::open() to set stream mode for passed file descriptor
-rw-r--r--libbutl/fdstream.cxx7
-rw-r--r--libbutl/fdstream.mxx6
2 files changed, 8 insertions, 5 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index 377681e..fad65f7 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -848,6 +848,13 @@ namespace butl
}
void ifdstream::
+ open (auto_fd&& fd, fdstream_mode m, std::uint64_t pos)
+ {
+ open (mode (std::move (fd), m), pos);
+ skip_ = (m & fdstream_mode::skip) == fdstream_mode::skip;
+ }
+
+ void ifdstream::
close ()
{
if (skip_ && is_open () && good ())
diff --git a/libbutl/fdstream.mxx b/libbutl/fdstream.mxx
index 0d56131..86ada51 100644
--- a/libbutl/fdstream.mxx
+++ b/libbutl/fdstream.mxx
@@ -521,11 +521,7 @@ LIBBUTL_MODEXPORT namespace butl
}
void
- open (auto_fd&& fd, fdstream_mode m, std::uint64_t pos = 0)
- {
- open (std::move (fd), pos);
- skip_ = (m & fdstream_mode::skip) == fdstream_mode::skip;
- }
+ open (auto_fd&& fd, fdstream_mode m, std::uint64_t pos = 0);
void close ();
auto_fd release (); // Note: no skipping.