[PATCH] pread bug fix

Hideki IWAMOTO h-iwamoto@kit.hi-ho.ne.jp
Sat Aug 19 21:35:00 GMT 2006


When current file offset is not zero, pread from disk file always fails.


2006-08-20 Hideki Iwamoto  <h-iwamoto@kit.hi-ho.ne.jp>

	* fhandler_disk_file.cc (fhandler_disk_file::pread): Fix comparison
	of return value of lseek.

Index: cygwin/fhandler_disk_file.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_disk_file.cc,v
retrieving revision 1.187
diff -u -p -r1.187 fhandler_disk_file.cc
--- cygwin/fhandler_disk_file.cc	10 Aug 2006 08:44:43 -0000	1.187
+++ cygwin/fhandler_disk_file.cc	19 Aug 2006 17:41:53 -0000
@@ -1216,7 +1216,7 @@ fhandler_disk_file::pread (void *buf, si
     {
       size_t tmp_count = count;
       read (buf, tmp_count);
-      if (lseek (curpos, SEEK_SET) == 0)
+      if (lseek (curpos, SEEK_SET) >= 0)
 	res = (ssize_t) tmp_count;
       else
 	res = -1;


----
Hideki IWAMOTO  h-iwamoto@kit.hi-ho.ne.jp



More information about the Cygwin-patches mailing list