From 4873b141ec8a0f586407b9e627dede231280d1b2 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Tue, 17 Jul 2018 17:08:58 +0900 Subject: [PATCH] Properly support w/+ in stdio? --- libc/stdio/stdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index 6bdab086..454d76a9 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -157,13 +157,13 @@ static void parse_mode(const char * mode, int * flags_, int * mask_) { if (*x == 'w') { flags |= O_WRONLY; flags |= O_CREAT; + flags |= O_TRUNC; mask = 0666; } -#if 0 if (*x == '+') { - /* Also set up for read? */ + flags |= O_RDWR; + flags ^= (O_APPEND); /* uh... */ } -#endif ++x; }