]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/SemihostFs: Fixed DataAbort in Semihosting File System
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Jul 2012 20:22:02 +0000 (20:22 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Jul 2012 20:22:02 +0000 (20:22 +0000)
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13501 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c

index a9d1c37c5cb9e3910a135ed46c6255361a439f6c..e6604ba0e23bf15aca3a5f41c65ec862914648be 100644 (file)
@@ -263,18 +263,22 @@ FileDelete (
 \r
   Fcb = SEMIHOST_FCB_FROM_THIS(File);\r
 \r
-  // Get the filename from the Fcb\r
-  NameSize = AsciiStrLen (Fcb->FileName);\r
-  FileName = AllocatePool (NameSize + 1);\r
+  if (!Fcb->IsRoot) {\r
+    // Get the filename from the Fcb\r
+    NameSize = AsciiStrLen (Fcb->FileName);\r
+    FileName = AllocatePool (NameSize + 1);\r
 \r
-  AsciiStrCpy (FileName, Fcb->FileName);\r
+    AsciiStrCpy (FileName, Fcb->FileName);\r
 \r
-  // Close the file if it's open.  Disregard return status,\r
-  // since it might give an error if the file isn't open.\r
-  File->Close (File);\r
-    \r
-  // Call the semihost interface to delete the file.\r
-  Status = SemihostFileRemove (FileName);\r
+    // Close the file if it's open.  Disregard return status,\r
+    // since it might give an error if the file isn't open.\r
+    File->Close (File);\r
+\r
+    // Call the semihost interface to delete the file.\r
+    Status = SemihostFileRemove (FileName);\r
+  } else {\r
+    Status = EFI_UNSUPPORTED;\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -358,14 +362,19 @@ FileSetPosition (
 \r
   Fcb = SEMIHOST_FCB_FROM_THIS(File);\r
 \r
-  Status = SemihostFileLength (Fcb->SemihostHandle, &Length);\r
-  if (!EFI_ERROR(Status) && (Length < Position)) {\r
-    Position = Length;\r
-  }\r
+  if (!Fcb->IsRoot) {\r
+    Status = SemihostFileLength (Fcb->SemihostHandle, &Length);\r
+    if (!EFI_ERROR(Status) && (Length < Position)) {\r
+      Position = Length;\r
+    }\r
 \r
-  Status = SemihostFileSeek (Fcb->SemihostHandle, (UINT32)Position);\r
-  if (!EFI_ERROR(Status)) {\r
+    Status = SemihostFileSeek (Fcb->SemihostHandle, (UINT32)Position);\r
+    if (!EFI_ERROR(Status)) {\r
+      Fcb->Position = Position;\r
+    }\r
+  } else {\r
     Fcb->Position = Position;\r
+    Status = EFI_SUCCESS;\r
   }\r
 \r
   return Status;\r