only sync if file open for writing

This commit is contained in:
Dave Murphy 2009-06-09 18:20:22 +00:00
parent 980ade67d4
commit 76a9624d2e

View File

@ -316,10 +316,12 @@ int _FAT_close_r (struct _reent *r, int fd) {
_FAT_lock(&file->partition->lock); _FAT_lock(&file->partition->lock);
ret = _FAT_syncToDisc (file); if (file->write) {
if (ret != 0) { ret = _FAT_syncToDisc (file);
r->_errno = ret; if (ret != 0) {
ret = -1; r->_errno = ret;
ret = -1;
}
} }
file->inUse = false; file->inUse = false;