pci-assign: do not test path with access() before opening
commit6268520d7df9b3f183bb4397218c9287441bc04f
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 2 Nov 2015 14:17:37 +0000 (2 15:17 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 6 Nov 2015 12:42:38 +0000 (6 15:42 +0300)
tree300fc2ae1daa2b7760118336babc0b002ac87399
parentb30d80546421c6ea919096b596887f496c80af0a
pci-assign: do not test path with access() before opening

Using access() is a time-of-check/time-of-use race condition.  It is
okay to use them to provide better error messages, but that is pretty
much it.

In this case we can get the same error from fopen(), so just use
strerror and errno there---which actually improves the error
message most of the time.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/i386/pci-assign-load-rom.c