summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2015-05-21 20:16:42 -0700
committerDamien George <damien.p.george@gmail.com>2015-05-24 14:07:11 +0100
commit968b7dd173d58d917c18dfa7706087db2abcfa6c (patch)
tree3815f6a86ae2e3bc8cdd1b869b630ee253a83b49
parent3cb804de26eda34ad24d52b6c98fa43e51bd027a (diff)
downloadmicropython-968b7dd173d58d917c18dfa7706087db2abcfa6c.tar.gz
micropython-968b7dd173d58d917c18dfa7706087db2abcfa6c.zip
stmhal: Detect disk full condition
-rw-r--r--stmhal/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/file.c b/stmhal/file.c
index 3f7342bd6e..d09d0a0a89 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -88,6 +88,11 @@ STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t siz
*errcode = fresult_to_errno_table[res];
return MP_STREAM_ERROR;
}
+ if (sz_out != size) {
+ // The FatFS documentation says that this means disk full.
+ *errcode = ENOSPC;
+ return MP_STREAM_ERROR;
+ }
return sz_out;
}