summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libpciaccess/src/openbsd_pci.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libpciaccess/src/openbsd_pci.c b/lib/libpciaccess/src/openbsd_pci.c
index 24759dd8c..a93832cee 100644
--- a/lib/libpciaccess/src/openbsd_pci.c
+++ b/lib/libpciaccess/src/openbsd_pci.c
@@ -599,8 +599,11 @@ pci_system_openbsd_create(void)
for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) {
snprintf(path, sizeof(path), "/dev/pci%d", domain);
pcifd[domain] = open(path, O_RDWR | O_CLOEXEC);
- if (pcifd[domain] == -1)
- break;
+ if (pcifd[domain] == -1) {
+ pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC);
+ if (pcifd[domain] == -1)
+ break;
+ }
ndomains++;
}