diff options
Diffstat (limited to 'userland/libc/stdio/fopen.c')
-rw-r--r-- | userland/libc/stdio/fopen.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/userland/libc/stdio/fopen.c b/userland/libc/stdio/fopen.c index fe0b5cf..38ccbf1 100644 --- a/userland/libc/stdio/fopen.c +++ b/userland/libc/stdio/fopen.c @@ -18,7 +18,7 @@ FILE *fopen(const char *pathname, const char *mode) { flag |= O_READ; break; case 'w': - flag |= O_WRITE; + flag |= O_WRITE | O_TRUNC; break; case 'a': flag |= O_APPEND; @@ -36,9 +36,6 @@ FILE *fopen(const char *pathname, const char *mode) { close(fd); return NULL; } - if(flag & O_WRITE) { - ftruncate(fd, 0); - } r->has_control_over_the_fd = 1; return r; } |