From ec204563b1fa9d691c22be93d8a6ed26673e379c Mon Sep 17 00:00:00 2001 From: Christopher Williams Date: Thu, 4 Feb 2021 17:02:02 -0700 Subject: [PATCH] R0.14a patch 1 February 3, 2021 File gets dead-locked when f_open funciton failed with some conditions. This is because the file is left locked when it is opened with FA_OPEN_APPEND flag and failed the function due to a seek error. --- source/ff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/ff.c b/source/ff.c index a378cf1..fca4371 100644 --- a/source/ff.c +++ b/source/ff.c @@ -3882,6 +3882,9 @@ FRESULT f_open ( #endif } } +#if FF_FS_LOCK != 0 + if (res != FR_OK) dec_lock(fp->obj.lockid); /* Decrement file open counter if seek failed */ +#endif } #endif }