aboutsummaryrefslogtreecommitdiff
path: root/libbutl/fdstream.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-12 16:36:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-12 16:54:36 +0200
commitc2d8cf50dae3e352053db2d75060ae8e6a026ab6 (patch)
treea61efe0a8ee5f4a07bf640600d52b3308c1d44b0 /libbutl/fdstream.cxx
parent0a8569041e821facad3fec80fe90c04a77f261df (diff)
Apply previous fix to fdstream::open()
Diffstat (limited to 'libbutl/fdstream.cxx')
-rw-r--r--libbutl/fdstream.cxx44
1 files changed, 24 insertions, 20 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index 7d1e755..50056a2 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -791,15 +791,14 @@ namespace butl
ifdstream::
ifdstream (const char* f, fdopen_mode m, iostate e)
- : ifdstream (
- fdopen (f,
- // If fdopen_mode::in is not specified, then emulate the
- // ios::in semantics.
- //
- (m & fdopen_mode::in) == fdopen_mode::in
- ? m
- : m | translate_mode (in)),
- e)
+ : ifdstream (fdopen (f,
+ // If fdopen_mode::in is not specified, then
+ // emulate the ios::in semantics.
+ //
+ (m & fdopen_mode::in) == fdopen_mode::in
+ ? m
+ : m | translate_mode (in)),
+ e)
{
}
@@ -841,7 +840,10 @@ namespace butl
void ifdstream::
open (const char* f, fdopen_mode m)
{
- open (fdopen (f, m | fdopen_mode::in));
+ open (fdopen (f,
+ (m & fdopen_mode::in) == fdopen_mode::in
+ ? m
+ : m | translate_mode (in)));
}
void ifdstream::
@@ -900,15 +902,14 @@ namespace butl
ofdstream::
ofdstream (const char* f, fdopen_mode m, iostate e)
- : ofdstream (
- fdopen (f,
- // If fdopen_mode::out is not specified, then emulate the
- // ios::out semantics.
- //
- (m & fdopen_mode::out) == fdopen_mode::out
- ? m
- : m | translate_mode (out)),
- e)
+ : ofdstream (fdopen (f,
+ // If fdopen_mode::out is not specified, then
+ // emulate the ios::out semantics.
+ //
+ (m & fdopen_mode::out) == fdopen_mode::out
+ ? m
+ : m | translate_mode (out)),
+ e)
{
}
@@ -939,7 +940,10 @@ namespace butl
void ofdstream::
open (const char* f, fdopen_mode m)
{
- open (fdopen (f, m | fdopen_mode::out));
+ open (fdopen (f,
+ (m & fdopen_mode::out) == fdopen_mode::out
+ ? m
+ : m | translate_mode (out)));
}
// fd*() functions