This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]