From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 64DF51A1E2D for ; Mon, 8 Aug 2016 03:28:43 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 08 Aug 2016 03:28:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,489,1464678000"; d="scan'208";a="861587509" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by orsmga003.jf.intel.com with ESMTP; 08 Aug 2016 03:28:42 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jaben Carsey Date: Mon, 8 Aug 2016 18:28:33 +0800 Message-Id: <20160808102834.129372-6-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20160808102834.129372-1-ruiyu.ni@intel.com> References: <20160808102834.129372-1-ruiyu.ni@intel.com> MIME-Version: 1.0 Subject: [PATCH 5/6] ShellPkg/ls: Fix to support "ls fs0:File.txt" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 10:28:43 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “ls fs0:\File.txt" can list the file correctly but when the backslash is removed from colon, the file cannot be listed. The patch fixes this issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey --- ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index 25bf8ca..6d3cc95 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -2,7 +2,7 @@ Main file for ls shell level 2 function. (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -707,10 +707,9 @@ ShellCommandRunLs ( // // must split off the search part that applies to files from the end of the directory part // - for (StrnCatGrow(&SearchString, NULL, PathName, 0) - ; SearchString != NULL && StrStr(SearchString, L"\\") != NULL - ; CopyMem(SearchString, StrStr(SearchString, L"\\") + 1, 1 + StrSize(StrStr(SearchString, L"\\") + 1))) ; - FullPath[StrLen(FullPath) - StrLen(SearchString)] = CHAR_NULL; + StrnCatGrow(&SearchString, NULL, FullPath, 0); + PathRemoveLastItem (FullPath); + CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath))); } } } -- 2.9.0.windows.1