From 64dedee2d141e5beca9080aa9a5cc53b3348af48 Mon Sep 17 00:00:00 2001 From: grunwald-m Date: Fri, 17 May 2019 13:48:37 +0200 Subject: [PATCH 1/2] prepare upstream bugfix of lfs -> call lfs_dir_fetchmatch with ftag=-1 in order to set the invalid bit and never let the function match a dir --- lfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lfs.c b/lfs.c index 95a3b6af..00210d74 100644 --- a/lfs.c +++ b/lfs.c @@ -975,9 +975,9 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs, static int lfs_dir_fetch(lfs_t *lfs, lfs_mdir_t *dir, const lfs_block_t pair[2]) { - // note, mask=-1, tag=0 can never match a tag since this + // note, mask=-1, tag=-1 can never match a tag since this // pattern has the invalid bit set - return (int)lfs_dir_fetchmatch(lfs, dir, pair, -1, 0, NULL, NULL, NULL); + return (int)lfs_dir_fetchmatch(lfs, dir, pair, -1, -1, NULL, NULL, NULL); } static int lfs_dir_getgstate(lfs_t *lfs, const lfs_mdir_t *dir, @@ -1643,7 +1643,6 @@ relocate: if (err && (err != LFS_ERR_NOSPC && !exhausted)) { return err; } - continue; } From 60e67ae080d016ed5c6e9140acf561ba97a838fb Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 26 Nov 2019 16:42:49 -0600 Subject: [PATCH 2/2] Fixed implicit change-of-sign warning in lfs_dir_fetch Warning on MDK v5.27.1 Found by geniusgogo --- lfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lfs.c b/lfs.c index 00210d74..24dbec31 100644 --- a/lfs.c +++ b/lfs.c @@ -977,7 +977,8 @@ static int lfs_dir_fetch(lfs_t *lfs, lfs_mdir_t *dir, const lfs_block_t pair[2]) { // note, mask=-1, tag=-1 can never match a tag since this // pattern has the invalid bit set - return (int)lfs_dir_fetchmatch(lfs, dir, pair, -1, -1, NULL, NULL, NULL); + return (int)lfs_dir_fetchmatch(lfs, dir, pair, + (lfs_tag_t)-1, (lfs_tag_t)-1, NULL, NULL, NULL); } static int lfs_dir_getgstate(lfs_t *lfs, const lfs_mdir_t *dir,