Переглянути джерело

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>
Benoît Thébaudeau 12 роки тому
батько
коміт
7ee46cebcb
1 змінених файлів з 4 додано та 4 видалено
  1. 4 4
      fs/fat/fat.c

+ 4 - 4
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);