public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: Fix access to block devices below /proc/sys. Date: Mon, 30 Nov 2020 10:59:03 +0000 (GMT) [thread overview] Message-ID: <20201130105903.B0933383F857@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3434d35a64736f0b77a12f61784c2caa33ac44cf commit 3434d35a64736f0b77a12f61784c2caa33ac44cf Author: Christian Franke <franke@computer.org> Date: Sat Nov 28 22:09:23 2020 +0100 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> Diff: --- winsup/cygwin/path.cc | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 4f5f03a76..7e6243d32 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -863,19 +863,28 @@ path_conv::check (const char *src, unsigned opt, dev.parse (FH_FS); goto is_fs_via_procsys; case virt_blk: - /* Block special device. If the trailing slash has been - requested, the target is the root directory of the - filesystem on this block device. So we convert this - to a real file and attach the backslash. */ - if (component == 0 && need_directory) + /* Block special device. Convert to a /dev/sd* like + block device unless the trailing slash has been + requested. In this case, the target is the root + directory of the filesystem on this block device. + So we convert this to a real file and attach the + backslash. */ + if (component == 0) { - dev.parse (FH_FS); - strcat (full_path, "\\"); - fileattr = FILE_ATTRIBUTE_DIRECTORY - | FILE_ATTRIBUTE_DEVICE; + fileattr = FILE_ATTRIBUTE_DEVICE; + if (!need_directory) + /* Use a /dev/sd* device number > /dev/sddx. + 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; } - fallthrough; + break; case virt_chr: if (component == 0) fileattr = FILE_ATTRIBUTE_DEVICE;
reply other threads:[~2020-11-30 10:59 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201130105903.B0933383F857@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).