Re: [RFC] Remote File I/O should allow opening non regular files

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 02 Jul 2016 14:02, Julio Guerra wrote:
> Today's implementation of `open()` first checks if the file is a regular
> file [1]. Is there any good reason for that limitation? I can't see any
> problem in opening special files. Most of them can be used with `read()`
> and `write()` only, without `ioctl()`, like any regular file. For
> example: TTYs, /dev/random, pipes, etc.

makes sense to me to delete that entire stat block of code.  it seems like
remote_fileio_return_errno should DTRT all the time (like trying to open a
dir and failing).  although that edge case might be worth checking.

i'd note that the current code is even racy (TOCTOU) so at the very least,
it should do the open first, and then fstat the fd to do all of the type
checks.
-mike
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXecbkAAoJEEFjO5/oN/WBG0YQAJhNfFDhTXIbwE4k96wonqEU
1GGFyOHiStj/ynLWkzhYac8ICkEk+MLZ4KslfRv+fpiIXDdOH1BV1kKQqmPCgWDG
gmIqzjX3eGKsWTsrVJN3Rb4tGr7w0MbQv9ffsilrZJgtlkKxzc62PB0V812ZYlvn
uTKgC5+qcgw4ELl2Kw6oiAfqKEwxxB2fprlGM25FbUuntOzhTug6g5huC5dxnYGz
VuapPoFgKKgp34N3nkLJHMyhGXZgGfGvsWcszbMG9nhDbUH8JCsRMOXbUjuNi4gZ
BipB7Jr1IqLyC9HLSqb+bNvPt8Yx9hntQnEp9RCfSCpfHjukkOZIXBEm+rEUObkL
t2LuYR8Zo8ApLd/6qp4WiBwo7pB7CeQBPiUhzVE+Ck5mf9W6ZEAQ+mgNPVc/2s+x
FYR6LL2lrFRXhrNECHaBZorH/nfA8Ftj4jgFmMxkC6xlQazv9VSGEh3PmXb6e2BM
fZT/GfqBDvh6NZWGycFYkWJSTVB9B6OKwdjm4/q//RSjx5cVkoSxXx4IhbQMVSiF
+ZW4iFtxy3N3eqmy30zp1rltZmLKLsHq5AU1ND5IqjVDuFs+S5jfTEMkQi6whn/S
dXH1ZXbLJbRdQF5WPytY1wPU5xoEvIvRvBPI+rRCSkgNR0q0N10aNyw4Y6KNXezd
0dsqyozkF9qSQQ2aX2uu
=e703
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.