Kevin, Collissions are bad, but what about
IF ! STRNCMP (filename, "/proc/self/fd/", 14) THEN fopen(filename, "r") ELSE fdopen(atoi(filename+14), "r") FI modulo better validation for the atio() arguments. Probability of anyone using "/proc/self/fd/" as a prefix for normal files is very small. Small enough it will be justifiable to say "do that and you are on your own". ? regards ronnie sahlberg On Thu, Jan 26, 2012 at 8:08 PM, Kevin Wolf <kw...@redhat.com> wrote: > Am 25.01.2012 16:57, schrieb Eric Blake: >> On 01/24/2012 11:47 PM, ronnie sahlberg wrote: >>> Read from an arbitra filedescriptor inherited from the parent process : >>> 9<iscsi.conf ./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -display >>> vnc=127.0.0.1:0 -drive file=iscsi://127.0.0.1/iqn.ronnie.test/1 >>> -readconfig /proc/self/fd/9 >> >> That requires the existence of procfs, which is not portable (although >> it does work on Linux). I'd rather see: >> >> -readconfig fd:9 >> >> which matches things for -incoming; that is, if -readconfig starts with >> '/' or '.', it is a filename; otherwise, it is a protocol:value >> designation, where we recognize at least the fd: protocol where a value >> is the incoming fd, but we could also recognize things like exec: >> protocol which is an arbitrary command to use via popen. > > Magic prefixes like this have one big problem: What if someone has a > config file called "fd:9"? We have the very same problem with protocols > in the block layer and while in the general case it's a convenient > syntax, we've come to hate it in cases where it misinterprets things. > > Kevin