From 3a35139e6c04f3ef6686e5382c2098891db0aba7 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 8 Jan 2013 15:07:38 +0100 Subject: [PATCH] Fix fopen(filename, "w") not creating files. --- libc/fdio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/fdio.c b/libc/fdio.c index 2d158f01..1e518889 100644 --- a/libc/fdio.c +++ b/libc/fdio.c @@ -185,9 +185,8 @@ FILE* fopen(const char* path, const char* mode) { case 'r': omode = O_RDONLY; break; case 'a': oflags |= O_APPEND; /* fall-through */ - case 'w': omode = O_WRONLY; break; + case 'w': omode = O_WRONLY; oflags |= O_CREAT | O_TRUNC; break; case '+': - if ( omode == O_WRONLY ) { oflags |= O_CREAT | O_TRUNC; } omode = O_RDWR; break; case 'b': break;