From patchwork Thu Jul 19 22:02:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 172089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 1B69D2C0332 for ; Fri, 20 Jul 2012 07:57:32 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9B5A628095; Thu, 19 Jul 2012 23:57:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wv1o8D8Vwvu7; Thu, 19 Jul 2012 23:57:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9D4728097; Thu, 19 Jul 2012 23:57:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE9FD28097 for ; Thu, 19 Jul 2012 23:57:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yhm7-xHiyUSc for ; Thu, 19 Jul 2012 23:57:24 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from zose-mta12.web4all.fr (zose-mta12.web4all.fr [178.33.204.89]) by theia.denx.de (Postfix) with ESMTP id 6813428096 for ; Thu, 19 Jul 2012 23:57:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zose-mta12.web4all.fr (Postfix) with ESMTP id 38FEB904F0; Thu, 19 Jul 2012 23:59:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at zose1.web4all.fr Received: from zose-mta12.web4all.fr ([127.0.0.1]) by localhost (zose-mta12.web4all.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZbJF0HE90ZSH; Thu, 19 Jul 2012 23:59:50 +0200 (CEST) Received: from zose-store12.web4all.fr (zose-store12.web4all.fr [178.33.204.49]) by zose-mta12.web4all.fr (Postfix) with ESMTP id EAF52904EF; Thu, 19 Jul 2012 23:59:50 +0200 (CEST) Date: Fri, 20 Jul 2012 00:02:19 +0200 (CEST) From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= To: u-boot@lists.denx.de Message-ID: <588056413.294128.1342735339884.JavaMail.root@advansee.com> MIME-Version: 1.0 X-Originating-IP: [88.188.188.98] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - FF3.0 (Win)/7.2.0_GA_2669) Subject: [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Wolfgang Denk --- .../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);