public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: <Jim.Dailey@dell.com>
To: <edk2-devel@lists.01.org>
Cc: <jaben.carsey@intel.com>, <ruiyu.ni@intel.com>
Subject: [PATCH] ShellPkg-Cd: Ensure all valid cd targets are handled properly
Date: Thu, 4 Oct 2018 16:46:39 +0000	[thread overview]
Message-ID: <7c3028cd2495469badb355a79423080e@ausx13mps335.AMER.DELL.COM> (raw)

ShellPkg-Cd: Ensure all valid cd targets are handled properly

Make sure that PathCleanUpDirectories() is called on all valid targets
of the cd command.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
index 79dd2096f4..1eb7056aee 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
@@ -4,6 +4,7 @@
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2018, Dell Technologies. All rights reserved.<BR>
   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
@@ -261,9 +262,6 @@ ShellCommandRunCd (
 
         if (Param1Copy != NULL && IsCurrentFileSystem (Param1Copy, Cwd)) {
           Status = ReplaceDriveWithCwd (&Param1Copy,Cwd);
-          if (!EFI_ERROR (Status)) {
-            Param1Copy = PathCleanUpDirectories (Param1Copy);
-          }
         } else {
           //
           // Can't use cd command to change filesystem.
@@ -302,13 +300,15 @@ ShellCommandRunCd (
                 StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), Param1Copy);
 
                 FreePool (Param1Copy);
-                Param1Copy = PathCleanUpDirectories (TempBuffer);
+                Param1Copy = TempBuffer;
+                TempBuffer = NULL;
               }
             }
           }
         }
 
         if (!EFI_ERROR(Status)) {
+          Param1Copy = PathCleanUpDirectories (Param1Copy);
           Status = ExtractDriveAndPath (Param1Copy, &Drive, &Path);
         }
 
-- 
2.17.0.windows.1



             reply	other threads:[~2018-10-04 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 16:46 Jim.Dailey [this message]
2018-10-08 14:53 ` [PATCH] ShellPkg-Cd: Ensure all valid cd targets are handled properly Carsey, Jaben
2018-10-12  5:46   ` Ni, Ruiyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c3028cd2495469badb355a79423080e@ausx13mps335.AMER.DELL.COM \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox