FAT: Fix file contents listed as directory
PATCH 4/7 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.
--- .../fs/fat/fat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/fat/fat.c +4 -4
@@ -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);
PATCH v2 5/8 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.
---
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(-)
fs/fat/fat.c +4 -4
@@ -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);
PATCH v2 5/8 FAT: Fix file contents listed as directory
Dear Beno?t Th?baudeau,
Quoted 7 lines · In message <[email protected]> you…
With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular fileThe 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.
But this means that "fatls" on a plain file stops working?
This doesn't make sense to me. Or what am I missing?
Patch skipped for now.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer.
PATCH v2 5/8 FAT: Fix file contents listed as directory
Dear Wolfgang Denk,
Quoted 10 lines · Wolfgang Denk
Dear Beno?t Th?baudeau,
In message <[email protected]> you
Quoted 5 lines · wrote:
With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular file
Quoted 8 lines
Quoted 4 lines
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.But this means that "fatls" on a plain file stops working?
This doesn't make sense to me. Or what am I missing?
This already did not work before, because "fatls" is supposed to support only directories:
$ help fatls fatls - list files in a directory (default /)
Usage:
fatls <interface> <dev[:part]> [directory]
- list files from 'dev' on 'interface' in a 'directory'
Best regards,
Beno?t
PATCH v2 5/8 FAT: Fix file contents listed as directory
Quoted 25 lines · Beno??t Th??baudeau
Dear Wolfgang Denk,
Quoted 10 lines · Wolfgang Denk
Dear Beno??t Th??baudeau,
In message <[email protected]> you
Quoted 5 lines · wrote:
With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular fileQuoted 8 lines
Quoted 4 lines
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.But this means that "fatls" on a plain file stops working?
This doesn't make sense to me. Or what am I missing?
This already did not work before, because "fatls" is supposed to support only directories:
Quoted 6 lines
$ help fatls fatls - list files in a directory (default /)Usage:
fatls <interface> <dev[:part]> [directory]
- list files from 'dev' on 'interface' in a 'directory'
Note that ext2ls _also_ fails to ls files so we're being consistent as I believe Wolfgang was expecting that *ls of a file would work like real ls does, but that's not the case. Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/92f842f0/attachment.pgp>