From: Benoît Thébaudeau Date: Fri, 20 Jul 2012 03:20:29 +0000 (+0000) Subject: FAT: Fix file contents listed as directory X-Git-Tag: v2012.10-rc1~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7ee46cebcbee82e3522b84a82041e4aa86760e40;p=u-boot FAT: Fix file contents listed as directory With: fatls mmc 0 /dir/file dir: regular directory file: regular file The previous code read the contents of file as if it were directory entries to list. This patch refuses to list file contents as if it were a folder. Signed-off-by: Benoît Thébaudeau Cc: Wolfgang Denk --- diff --git a/fs/fat/fat.c b/fs/fat/fat.c index f7bb1dadff..19f6a8c0af 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1109,11 +1109,11 @@ rootdir_done: goto exit; } - if (idx >= 0) { - if (!(dentptr->attr & ATTR_DIR)) - goto exit; + if (isdir && !(dentptr->attr & ATTR_DIR)) + goto exit; + + if (idx >= 0) subname = nextname; - } } ret = get_contents(mydata, dentptr, buffer, maxsize);