From 33c2646b6f93748d13eabbeb076a6a6d6ecc59d6 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sat, 28 Aug 2021 11:22:07 -0400 Subject: 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. --- stream.c | 3 +-- 1 file changed, 1 insertion(+), 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) -- cgit v1.2.3