summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>2012-07-20 03:20:29 +0000
committerTom Rini <trini@ti.com>2012-09-18 12:01:53 -0700
commit7ee46cebcbee82e3522b84a82041e4aa86760e40 (patch)
treead6e2e1ec32fd51c31b9c2759e9228e325670440
parentd5370febbcbcee3f554df13ed72b7e2b91e5f66c (diff)
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 <benoit.thebaudeau@advansee.com> Cc: Wolfgang Denk <wd@denx.de>
-rw-r--r--fs/fat/fat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index f7bb1dadff3..19f6a8c0af6 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);