]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/ReadWrite.c
EFI_FILE_PROTOCOL spec conformance bug fix.
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / ReadWrite.c
index 4621817c93d2562490142c6b3a7502f8d4be8cce..9afb6bff89e06f4f7bf4354cd3321c98f1c28296 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution. The full text of the license may be found at\r
@@ -250,6 +250,13 @@ Returns:
   Volume = OFile->Volume;\r
   Task   = NULL;\r
 \r
+  //\r
+  // Write to a directory is unsupported\r
+  //\r
+  if ((OFile->ODir != NULL) && (IoMode == WRITE_DATA)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   if (OFile->Error == EFI_NOT_FOUND) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
@@ -296,16 +303,10 @@ Returns:
   if (!EFI_ERROR (Status)) {\r
     if (OFile->ODir != NULL) {\r
       //\r
-      // Access a directory\r
+      // Read a directory is supported\r
       //\r
-      Status = EFI_UNSUPPORTED;\r
-      if (IoMode == READ_DATA) {\r
-        //\r
-        // Read a directory is supported\r
-        //\r
-        Status = FatIFileReadDir (IFile, BufferSize, Buffer);\r
-      }\r
-\r
+      ASSERT (IoMode == READ_DATA);\r
+      Status = FatIFileReadDir (IFile, BufferSize, Buffer);\r
       OFile = NULL;\r
     } else {\r
       //\r