* errno.cc (errmap): Map ERROR_INVALID_BLOCK_LENGTH to EIO.

* fhandler_raw.cc (fhandler_dev_raw::raw_read): Set more accurate
	errnos instead of EACCES.
	(fhandler_dev_raw::raw_write): Ditto.
This commit is contained in:
Corinna Vinschen 2003-08-17 17:12:18 +00:00
parent 293ce8104d
commit 22d82f9f46
3 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2003-08-17 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Map ERROR_INVALID_BLOCK_LENGTH to EIO.
* fhandler_raw.cc (fhandler_dev_raw::raw_read): Set more accurate
errnos instead of EACCES.
(fhandler_dev_raw::raw_write): Ditto.
2003-08-17 Christopher Faylor <cgf@redhat.com> 2003-08-17 Christopher Faylor <cgf@redhat.com>
* path.cc (special_name): Accommodate all special names with * path.cc (special_name): Accommodate all special names with

View File

@ -112,6 +112,7 @@ static NO_COPY struct
X (NOACCESS, EFAULT), X (NOACCESS, EFAULT),
X (FILE_INVALID, ENXIO), X (FILE_INVALID, ENXIO),
X (INVALID_ADDRESS, EOVERFLOW), X (INVALID_ADDRESS, EOVERFLOW),
X (INVALID_BLOCK_LENGTH, EIO),
{ 0, NULL, 0} { 0, NULL, 0}
}; };

View File

@ -202,7 +202,10 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
ret = writebuf (); ret = writebuf ();
if (ret) if (ret)
{ {
set_errno (is_eom (ret) ? ENOSPC : EACCES); if (is_eom (ret))
set_errno (ENOSPC);
else
__seterrno ();
goto err; goto err;
} }
@ -267,8 +270,7 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
{ {
if (!is_eof (ret) && !is_eom (ret)) if (!is_eof (ret) && !is_eom (ret))
{ {
debug_printf ("return -1, set errno to EACCES"); __seterrno ();
set_errno (EACCES);
goto err; goto err;
} }
@ -309,8 +311,7 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
{ {
if (!is_eof (ret) && !is_eom (ret)) if (!is_eof (ret) && !is_eom (ret))
{ {
debug_printf ("return -1, set errno to EACCES"); __seterrno ();
set_errno (EACCES);
goto err; goto err;
} }
if (bytes_read) if (bytes_read)
@ -442,7 +443,7 @@ fhandler_dev_raw::raw_write (const void *ptr, size_t len)
has_written = 1; has_written = 1;
if (!is_eom (ret)) if (!is_eom (ret))
{ {
set_errno (EACCES); __seterrno ();
return -1; return -1;
} }
eom_detected = 1; eom_detected = 1;