From 968b7dd173d58d917c18dfa7706087db2abcfa6c Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Thu, 21 May 2015 20:16:42 -0700 Subject: [PATCH] stmhal: Detect disk full condition --- stmhal/file.c | 5 +++++ 1 file changed, 5 insertions(+) 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; }