Commit 51c38cc7 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Fix blatantly wrong SetFilePointer() calls.

parent 94c02fef
...@@ -605,7 +605,7 @@ int _locking(int fd, int mode, LONG nbytes) ...@@ -605,7 +605,7 @@ int _locking(int fd, int mode, LONG nbytes)
(mode==_LK_NBRLCK)?"_LK_NBRLCK": (mode==_LK_NBRLCK)?"_LK_NBRLCK":
"UNKNOWN"); "UNKNOWN");
if ((cur_locn = SetFilePointer(hand, 0L, NULL, SEEK_CUR)) == 0xffffffff) if ((cur_locn = SetFilePointer(hand, 0L, NULL, SEEK_CUR)) == INVALID_SET_FILE_POINTER)
{ {
FIXME ("Seek failed\n"); FIXME ("Seek failed\n");
*MSVCRT__errno() = MSVCRT_EINVAL; /* FIXME */ *MSVCRT__errno() = MSVCRT_EINVAL; /* FIXME */
......
...@@ -110,7 +110,8 @@ STORAGE_get_big_block(HANDLE hf,int n,BYTE *block) ...@@ -110,7 +110,8 @@ STORAGE_get_big_block(HANDLE hf,int n,BYTE *block)
DWORD result; DWORD result;
assert(n>=-1); assert(n>=-1);
if (!SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET )) if ((SetFilePointer( hf, (n+1)*BIGSIZE, NULL,
SEEK_SET ) == INVALID_SET_FILE_POINTER) && GetLastError())
{ {
WARN(" seek failed (%ld)\n",GetLastError()); WARN(" seek failed (%ld)\n",GetLastError());
return FALSE; return FALSE;
...@@ -132,9 +133,10 @@ STORAGE_put_big_block(HANDLE hf,int n,BYTE *block) ...@@ -132,9 +133,10 @@ STORAGE_put_big_block(HANDLE hf,int n,BYTE *block)
DWORD result; DWORD result;
assert(n>=-1); assert(n>=-1);
if (!SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET )) if ((SetFilePointer( hf, (n+1)*BIGSIZE, NULL,
SEEK_SET ) == INVALID_SET_FILE_POINTER) && GetLastError())
{ {
WARN(" seek failed (%ld)\n",GetLastError()); WARN("seek failed (%ld)\n",GetLastError());
return FALSE; return FALSE;
} }
if (!WriteFile( hf, block, BIGSIZE, &result, NULL ) || result != BIGSIZE) if (!WriteFile( hf, block, BIGSIZE, &result, NULL ) || result != BIGSIZE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment