From 15634965e8f0ab753898f5607ba11288556d1235 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 5 Jul 2016 16:01:33 +0300 Subject: Fix ~ofdstream() not to sync if good() returns false --- butl/fdstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'butl') 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);} -- cgit v1.1