summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2021-08-28 11:22:07 -0400
committerKaz Kylheku <kaz@kylheku.com>2021-08-28 08:57:51 -0700
commit4088dec1dfd66df9c26acdb64cd4a7ae0c2bbfb9 (patch)
treec8785fd154d05a0b9969eca6ad717a9d2066eb51
parent571a1cb6db6a59fab76e95b88738fb7e94a096ae (diff)
downloadtxr-4088dec1dfd66df9c26acdb64cd4a7ae0c2bbfb9.tar.gz
txr-4088dec1dfd66df9c26acdb64cd4a7ae0c2bbfb9.tar.bz2
txr-4088dec1dfd66df9c26acdb64cd4a7ae0c2bbfb9.zip
open-file: fix broken "+" mode string.
The "+" mode string should be equivalent to "r+", according to the manual, but before this change it was equivalent to "r". * stream.c (do_parse_mode): Unconditionally set m.write to 1 when "+" is present in the mode string.
-rw-r--r--stream.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/stream.c b/stream.c
index 4fdd767e..f2ff72e2 100644
--- a/stream.c
+++ b/stream.c
@@ -1471,9 +1471,8 @@ static struct stdio_mode do_parse_mode(val mode_str, struct stdio_mode m_dfl,
if (*ms == '+') {
ms++;
- if (m.read)
- m.write = 1;
m.read = 1;
+ m.write = 1;
}
if (!m.read && !m.write)