]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/misc: fix handling of size 0 in FileIO_Preadv
authorVMware, Inc <>
Thu, 2 Aug 2012 06:52:58 +0000 (23:52 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Thu, 2 Aug 2012 18:23:08 +0000 (11:23 -0700)
When file of size zero is used, we should return success.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/file/fileIOPosix.c

index 524a29abbc597e17d29ccbf93adda26562e3c1f7..c62245dc6cf9940b53c5ac917cedf42e15e8f483 100644 (file)
@@ -1994,14 +1994,15 @@ FileIOPreadvInternal(FileIODescriptor *fd,   // IN: File descriptor
          break;
       }
       bytesRead += retval;
-      if (retval == 0) {
-         fret = FILEIO_READ_ERROR_EOF;
-         break;
-      }
       if (bytesRead == totalSize) {
          fret =  FILEIO_SUCCESS;
          break;
       }
+      if (retval == 0) {
+         fret = FILEIO_READ_ERROR_EOF;
+         break;
+      }
+
       /*
        * This is an ambiguous case in linux preadv implementation.
        * If the bytesRead matches an exact iovector boundary, we need