Set truncate flag to make sure that overwriting a existing file doesn't result in a mix of old and new content.

This commit is contained in:
oliverschmidt 2007-12-23 14:12:44 +00:00
parent fda38428d9
commit f67506ba2a

View file

@ -30,7 +30,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: cfs-posix.c,v 1.7 2007/12/21 01:36:01 oliverschmidt Exp $ * $Id: cfs-posix.c,v 1.8 2007/12/23 14:12:44 oliverschmidt Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -43,7 +43,7 @@
int int
cfs_open(const char *n, int f) cfs_open(const char *n, int f)
{ {
return open(n, f == CFS_READ? O_RDONLY: O_CREAT|O_RDWR); return open(n, f == CFS_READ? O_RDONLY: O_CREAT|O_TRUNC|O_RDWR);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void