aboutsummaryrefslogtreecommitdiff
path: root/butl/fdstream
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-05 16:01:33 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-07 17:39:45 +0300
commit15634965e8f0ab753898f5607ba11288556d1235 (patch)
treea1db7a7cf7d29e6194f5eea2ca941d25248a56b1 /butl/fdstream
parent8f5677089f439b3ae97c430eb61040287459f63d (diff)
Fix ~ofdstream() not to sync if good() returns false
Diffstat (limited to 'butl/fdstream')
-rw-r--r--butl/fdstream2
1 files changed, 1 insertions, 1 deletions
diff --git a/butl/fdstream b/butl/fdstream
index 0be3708..21df3f8 100644
--- a/butl/fdstream
+++ b/butl/fdstream
@@ -122,7 +122,7 @@ namespace butl
ofdstream (int fd, fdtranslate m)
: fdstream_base (fd, m), std::ostream (&buf_) {}
- ~ofdstream () override {if (is_open ()) buf_.sync ();}
+ ~ofdstream () override {if (is_open () && good ()) buf_.sync ();}
void close () {flush (); buf_.close ();}
void open (int fd) {buf_.open (fd);}