From 76a9624d2ebdeabb8829c91ed2732447bbd092e9 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 9 Jun 2009 18:20:22 +0000 Subject: [PATCH] only sync if file open for writing --- source/fatfile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/fatfile.c b/source/fatfile.c index 60b6267..36152f3 100644 --- a/source/fatfile.c +++ b/source/fatfile.c @@ -316,10 +316,12 @@ int _FAT_close_r (struct _reent *r, int fd) { _FAT_lock(&file->partition->lock); - ret = _FAT_syncToDisc (file); - if (ret != 0) { - r->_errno = ret; - ret = -1; + if (file->write) { + ret = _FAT_syncToDisc (file); + if (ret != 0) { + r->_errno = ret; + ret = -1; + } } file->inUse = false;