From 7a8386289b18678c2ee49ffdfcf71e3a2abd3258 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 16 Oct 2020 21:46:45 +0300 Subject: Fix ifdstream::open() to set stream mode for passed file descriptor --- libbutl/fdstream.cxx | 7 +++++++ libbutl/fdstream.mxx | 6 +----- 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. -- cgit v1.1