* fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Keep track of

current position in non-buffered case, too.
This commit is contained in:
Corinna Vinschen 2008-10-09 12:41:52 +00:00
parent 2768ae50dd
commit 3059d18288
2 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2008-10-09 Corinna Vinschen <corinna@vinschen.de>
* fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Keep track of
current position in non-buffered case, too.
2008-10-09 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (pwdgrp::read_group): Generate more speaking group name

View File

@ -338,20 +338,26 @@ fhandler_dev_floppy::raw_read (void *ptr, size_t& ulen)
}
}
}
else if (!read_file (p, len, &bytes_read, &ret))
else
{
if (!IS_EOM (ret))
_off64_t current_position = get_current_position ();
if (current_position + bytes_to_read >= drive_size)
bytes_to_read = drive_size - current_position;
if (bytes_to_read && !read_file (p, len, &bytes_read, &ret))
{
__seterrno ();
goto err;
}
if (bytes_read)
eom_detected (true);
else
{
debug_printf ("return -1, set errno to ENOSPC");
set_errno (ENOSPC);
goto err;
if (!IS_EOM (ret))
{
__seterrno ();
goto err;
}
if (bytes_read)
eom_detected (true);
else
{
debug_printf ("return -1, set errno to ENOSPC");
set_errno (ENOSPC);
goto err;
}
}
}