From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= Date: Fri, 20 Jul 2012 15:20:29 +0200 (CEST) Subject: [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory In-Reply-To: <588056413.294128.1342735339884.JavaMail.root@advansee.com> Message-ID: <2017658963.332562.1342790429735.JavaMail.root@advansee.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes for v2: - Patch renumbering because of the new v2 1/8. - Possible code style changes due to the new v2 1/8. .../fs/fat/fat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c index fbc2d7d..5d08948 100644 --- u-boot-66714b1.orig/fs/fat/fat.c +++ u-boot-66714b1/fs/fat/fat.c @@ -1103,11 +1103,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);