Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/libpciaccess/dist/src If O_RDWR fails, try O_...
details: https://anonhg.NetBSD.org/xsrc/rev/5fd2ebd6763f
branches: trunk
changeset: 9998:5fd2ebd6763f
user: maya <maya%NetBSD.org@localhost>
date: Fri Oct 26 11:17:33 2018 +0000
description:
If O_RDWR fails, try O_RDONLY.
Lets me run unprivileged X.
diffstat:
external/mit/libpciaccess/dist/src/netbsd_pci.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diffs (22 lines):
diff -r 1fbfbb884ca7 -r 5fd2ebd6763f external/mit/libpciaccess/dist/src/netbsd_pci.c
--- a/external/mit/libpciaccess/dist/src/netbsd_pci.c Fri Oct 26 11:13:29 2018 +0000
+++ b/external/mit/libpciaccess/dist/src/netbsd_pci.c Fri Oct 26 11:17:33 2018 +0000
@@ -924,6 +924,9 @@
nbuses = 0;
snprintf(netbsd_devname, 32, "/dev/pci%d", nbuses);
pcifd = open(netbsd_devname, O_RDWR | O_CLOEXEC);
+ if (pcifd == -1)
+ pcifd = open(netbsd_devname, O_RDONLY | O_CLOEXEC);
+
while (pcifd > 0) {
ioctl(pcifd, PCI_IOC_BUSINFO, &businfo);
buses[nbuses].fd = pcifd;
@@ -946,6 +949,8 @@
}
snprintf(netbsd_devname, 32, "/dev/pci%d", nbuses);
pcifd = open(netbsd_devname, O_RDWR);
+ if (pcifd == -1)
+ pcifd = open(netbsd_devname, O_RDONLY | O_CLOEXEC);
}
pci_sys->num_devices = ndevs;
Home |
Main Index |
Thread Index |
Old Index