diff options
author | Dick Porter <dick@acm.org> | 2004-07-08 19:10:07 +0400 |
---|---|---|
committer | Dick Porter <dick@acm.org> | 2004-07-08 19:10:07 +0400 |
commit | 14755203b01d24134677973fd039b1ca024a1b64 (patch) | |
tree | 98fab680bbabe72a08b74bfd5162c4ef7ca94cf4 | |
parent | a94236a83f0149100c568d022bcef00c0dbdb54e (diff) |
2004-07-08 Dick Porter <dick@ximian.com>
* io.c (file_seek): If there is a high 32bit offset part, make
sure the low part isn't sign-extended. Set error codes when
returning failure. Fixes bug 61131.
svn path=/branches/mono-1-0/mono/; revision=30877
-rw-r--r-- | mono/io-layer/ChangeLog | 6 | ||||
-rw-r--r-- | mono/io-layer/io.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog index b5644124bad..42fde43fdc9 100644 --- a/mono/io-layer/ChangeLog +++ b/mono/io-layer/ChangeLog @@ -1,3 +1,9 @@ +2004-07-08 Dick Porter <dick@ximian.com> + + * io.c (file_seek): If there is a high 32bit offset part, make + sure the low part isn't sign-extended. Set error codes when + returning failure. Fixes bug 61131. + 2004-07-06 Dick Porter <dick@ximian.com> * io.c (file_setfiletime): Check for underflow when converting to diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c index 2d953501c34..cdc616743fa 100644 --- a/mono/io-layer/io.c +++ b/mono/io-layer/io.c @@ -617,6 +617,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, if(ok==FALSE) { g_warning (G_GNUC_PRETTY_FUNCTION ": error looking up file handle %p", handle); + SetLastError (ERROR_INVALID_HANDLE); return(INVALID_SET_FILE_POINTER); } @@ -627,6 +628,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_private_handle->fd, file_handle->fileaccess); #endif + SetLastError (ERROR_ACCESS_DENIED); return(INVALID_SET_FILE_POINTER); } @@ -646,6 +648,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, method); #endif + SetLastError (ERROR_INVALID_PARAMETER); return(INVALID_SET_FILE_POINTER); } @@ -658,7 +661,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, movedistance); #endif } else { - offset=((gint64) *highmovedistance << 32) | movedistance; + offset=((gint64) *highmovedistance << 32) | (unsigned long)movedistance; #ifdef DEBUG g_message(G_GNUC_PRETTY_FUNCTION ": setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance); @@ -688,6 +691,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, handle, file_private_handle->fd, strerror(errno)); #endif + _wapi_set_last_error_from_errno (); return(INVALID_SET_FILE_POINTER); } |