* fhandler.cc (is_at_eof): Drop static storage class. Drop err

parameter since we don't change the Win32 error here anymore.
	(fhandler_base::raw_read): Accommodate change to is_at_eof.

	* fhandler_disk_file.cc (fhandler_disk_file::pread): In binary mode use
	direct call to NtReadFile, rather than lseek/read.
	(fhandler_disk_file::pwrite): In binary mode use direct call to
	NtWriteFile, rather than lseek/write.
This commit is contained in:
Corinna Vinschen
2011-05-05 09:05:04 +00:00
parent 03406c1ae6
commit 392323df55
3 changed files with 72 additions and 4 deletions

View File

@ -163,8 +163,8 @@ char *fhandler_base::get_proc_fd_name (char *buf)
/* Detect if we are sitting at EOF for conditions where Windows
returns an error but UNIX doesn't. */
static int __stdcall
is_at_eof (HANDLE h, DWORD err)
int __stdcall
is_at_eof (HANDLE h)
{
IO_STATUS_BLOCK io;
FILE_POSITION_INFORMATION fpi;
@ -176,7 +176,6 @@ is_at_eof (HANDLE h, DWORD err)
FilePositionInformation))
&& fsi.EndOfFile.QuadPart == fpi.CurrentByteOffset.QuadPart)
return 1;
SetLastError (err);
return 0;
}
@ -237,7 +236,7 @@ retry:
/* `bytes_read' is supposedly valid. */
break;
case ERROR_NOACCESS:
if (is_at_eof (get_handle (), errcode))
if (is_at_eof (get_handle ()))
{
bytes_read = 0;
break;