ShellPkg: Launch shell when startup.nsh is in the same directory

If there is a startup.nsh file in the same directory as the shell that
is being launched, the shell will abort. This change fixes that issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jim Dailey <[email protected]>
---
 ShellPkg/Application/Shell/Shell.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ShellPkg/Application/Shell/Shell.c 
b/ShellPkg/Application/Shell/Shell.c
index 40ae68d..c00b49b 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -1,6 +1,7 @@
 /** @file
   This is THE shell (application)
 
+  Copyright 2016 Dell Inc.
   Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>
   This program and the accompanying materials
@@ -1147,6 +1148,12 @@ DoStartupScript(
       PathRemoveLastItem(FileStringPath);
       FileStringPath = StrnCatGrow(&FileStringPath, &NewSize, mStartupScript, 
0);
       Status = 
ShellInfoObject.NewEfiShellProtocol->OpenFileByName(FileStringPath, 
&FileHandle, EFI_FILE_MODE_READ);
+      if (!EFI_ERROR(Status)) {
+        Status = RunScriptFile (FileStringPath, FileHandle, L"", 
ShellInfoObject.NewShellParametersProtocol);
+        ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);
+        FreePool(FileStringPath);
+        return Status;
+      }
       FreePool(FileStringPath);
     }
   }
-- 
2.7.1.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to