]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
FAT: Fix file contents listed as directory
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Fri, 20 Jul 2012 03:20:29 +0000 (03:20 +0000)
committerTom Rini <trini@ti.com>
Tue, 18 Sep 2012 19:01:53 +0000 (12:01 -0700)
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

index f7bb1dadff39c6906fecd61c24c3d95722e11403..19f6a8c0af63acbe5b95fc2aa822d823354625c9 100644 (file)
@@ -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);