diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-09-06 23:33:21 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-09-06 23:33:21 +0000 |
commit | 8537e2d12ac8af7f548972cd4ad2477112dfb5ac (patch) | |
tree | a183b1b3604c0cb28da0826c62032d2e535bb672 /firmware/common/file.c | |
parent | f1847ee78368bc4547555699f8a91925f06377fa (diff) |
Bug fix: open() now handles O_TRUNC correctly (this was the real cause for the .playlist_control corruption)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5048 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r-- | firmware/common/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 546a927037..c09a7fea6e 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -135,7 +135,7 @@ int open(const char* pathname, int flags) fat_open(entry->startcluster, &(file->fatfile), &(dir->fatdir)); - file->size = entry->size; + file->size = file->trunc ? 0 : entry->size; file->attr = entry->attribute; break; } @@ -236,7 +236,7 @@ int fsync(int fd) /* truncate? */ if (file->trunc) { - rc = ftruncate(fd, file->fileoffset); + rc = ftruncate(fd, file->size); if (rc < 0) return rc * 10 - 4; } |