This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] pread bug fix


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]