Tftp command always returned "SHELL_NOT_FOUND" which is treated as an
error by callers. Add missing line to clean the ShellStatus on
successful operation. If operation has failed, return the error status
if available.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyanni...@broadcom.com>
---
 ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c 
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index ba753a279b00..88e3988a554e 100644
--- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -548,6 +548,8 @@ RunTftp (
       goto NextHandle;
     }
 
+    ShellStatus = SHELL_SUCCESS;
+
     NextHandle:
 
     CloseProtocolAndDestroyServiceChild (
@@ -575,6 +577,10 @@ RunTftp (
     FreePool (Handles);
   }
 
+  if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR(Status))) {
+    ShellStatus = Status & ~MAX_BIT;
+  }
+
   return ShellStatus;
 }
 
-- 
2.20.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to