Hi all,

I am committing this small patch to make lseek handle the case there an invalid whence
is passed. The error handling is delegated to SetFilePointer.
(Remember that there is no errno in coredll.dll, only Get|SetLastError(), which doesn't map perfectly).

Cheers,
Pedro Alves
---

2006-11-12  Pedro Alves  <[EMAIL PROTECTED]>

   * mingwex/wince/lseek.c: Handle invalid whence.

Index: wince/lseek.c
===================================================================
--- wince/lseek.c       (revision 786)
+++ wince/lseek.c       (working copy)
@@ -4,7 +4,7 @@
 long
 _lseek (int fildes, long offset, int whence)
 {
-  DWORD mode = 0;
+  DWORD mode;
   switch (whence)
     {
     case SEEK_SET:
@@ -16,6 +16,9 @@
     case SEEK_END:
       mode = FILE_END;
       break;
+    default:
+     /* Specify an invalid mode so SetFilePointer catches it.  */
+      mode = (DWORD)-1;
     }
   return (long) SetFilePointer ((HANDLE) fildes, offset, NULL, mode);
 }
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to