From 7ee46cebcbee82e3522b84a82041e4aa86760e40 Mon Sep 17 00:00:00 2001 From: Benoît Thébaudeau Date: Fri, 20 Jul 2012 03:20:29 +0000 Subject: FAT: Fix file contents listed as directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- fs/fat/fat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/fat') 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); -- cgit