Cygwin: Fix access to block devices below /proc/sys.

Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.

Signed-off-by: Christian Franke <franke@computer.org>
This commit is contained in:
Christian Franke 2020-11-28 22:09:23 +01:00 committed by Corinna Vinschen
parent 7fa8405d3f
commit 3434d35a64
1 changed files with 19 additions and 10 deletions

View File

@ -863,19 +863,28 @@ path_conv::check (const char *src, unsigned opt,
dev.parse (FH_FS); dev.parse (FH_FS);
goto is_fs_via_procsys; goto is_fs_via_procsys;
case virt_blk: case virt_blk:
/* Block special device. If the trailing slash has been /* Block special device. Convert to a /dev/sd* like
requested, the target is the root directory of the block device unless the trailing slash has been
filesystem on this block device. So we convert this requested. In this case, the target is the root
to a real file and attach the backslash. */ directory of the filesystem on this block device.
if (component == 0 && need_directory) So we convert this to a real file and attach the
backslash. */
if (component == 0)
{ {
dev.parse (FH_FS); fileattr = FILE_ATTRIBUTE_DEVICE;
strcat (full_path, "\\"); if (!need_directory)
fileattr = FILE_ATTRIBUTE_DIRECTORY /* Use a /dev/sd* device number > /dev/sddx.
| FILE_ATTRIBUTE_DEVICE; FIXME: Define a new major DEV_ice number. */
dev.parse (DEV_SD_HIGHPART_END, 9999);
else
{
dev.parse (FH_FS);
strcat (full_path, "\\");
fileattr |= FILE_ATTRIBUTE_DIRECTORY;
}
goto out; goto out;
} }
fallthrough; break;
case virt_chr: case virt_chr:
if (component == 0) if (component == 0)
fileattr = FILE_ATTRIBUTE_DEVICE; fileattr = FILE_ATTRIBUTE_DEVICE;