summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/common/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 3755560998..83c8e045fa 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -406,10 +406,10 @@ static int readwrite(int fd, void* buf, int count, bool write)
406 } 406 }
407 407
408 /* if buffer has been modified, write it back to disk */ 408 /* if buffer has been modified, write it back to disk */
409 if (count && file->dirty) { 409 if (nread && file->dirty) {
410 rc = flush_cache(fd); 410 rc = flush_cache(fd);
411 if (rc < 0) 411 if (rc < 0)
412 return nread ? nread : rc * 10 - 3; 412 return rc * 10 - 3;
413 } 413 }
414 414
415 /* read whole sectors right into the supplied buffer */ 415 /* read whole sectors right into the supplied buffer */