public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory
@ 2012-07-19 22:02 Benoît Thébaudeau
  2012-07-20 13:20 ` [U-Boot] [PATCH v2 5/8] " Benoît Thébaudeau
  0 siblings, 1 reply; 5+ messages in thread
From: Benoît Thébaudeau @ 2012-07-19 22:02 UTC (permalink / raw)
  To: u-boot

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 <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 .../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 fcce412..943cdb6 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -1105,11 +1105,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);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-18 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 22:02 [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory Benoît Thébaudeau
2012-07-20 13:20 ` [U-Boot] [PATCH v2 5/8] " Benoît Thébaudeau
2012-09-02 15:21   ` Wolfgang Denk
2012-09-03 14:08     ` Benoît Thébaudeau
2012-09-18 19:03       ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox