From 4544d164738d6efe20e3d1fac514d993fc969ee6 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Sat, 1 Mar 2008 13:44:13 -0500 Subject: [PATCH] Don't read 0-size ROM files through sysfs. (bug #13988) Instead read devmem. --- src/linux_sysfs.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index ba5dce2..635f669 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -320,6 +320,11 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer ) return errno; } + if ( st.st_size == 0 ) { + close( fd ); + return pci_device_linux_devmem_read_rom(dev, buffer); + } + /* This is a quirky thing on Linux. Even though the ROM and the file * for the ROM in sysfs are read-only, the string "1" must be written to -- 1.5.4.3