Fixed handling of CFS_WRITE and CFS_APPEND
This commit is contained in:
parent
c55f320bd5
commit
bac526c5f1
5 changed files with 60 additions and 15 deletions
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: cfs-eeprom.c,v 1.4 2007/11/22 11:29:13 oliverschmidt Exp $
|
||||
* $Id: cfs-eeprom.c,v 1.5 2008/01/08 14:27:06 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include "cfs/cfs.h"
|
||||
|
@ -57,7 +57,17 @@ cfs_open(const char *n, int f)
|
|||
{
|
||||
if(file.flag == FLAG_FILE_CLOSED) {
|
||||
file.flag = FLAG_FILE_OPEN;
|
||||
file.fileptr = 0;
|
||||
if(f & CFS_READ) {
|
||||
file.fileptr = 0;
|
||||
}
|
||||
if(f & CFS_WRITE){
|
||||
if(f & CFS_APPEND) {
|
||||
file.fileptr = file.filesize;
|
||||
} else {
|
||||
file.fileptr = 0;
|
||||
file.filesize = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue