+2005-12-12 Martin Mares <mj@ucw.cz>
+
+ * lib/nbsd-libpci.c: If libpci is used by an ordinary user, allow
+ at least read-only access. Patch by Pavel Celeda <celeda@liberouter.org>.
+
+ * Makefile: Corrected library path on NetBSD.
+
2005-11-26 Martin Mares <mj@ucw.cz>
* Released as 2.2.1.
PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
ifeq ($(shell uname),NetBSD)
-PCILIB=libpciutils.a
+PCILIB=lib/libpciutils.a
LDFLAGS+=-lpci
else
ifeq ($(shell uname),AIX)
a->warning("Cannot open %s", name);
return 0;
}
+
+ if (!access(name, W_OK))
+ {
+ a->writeable = O_RDWR;
+ }
a->debug("...using %s", name);
return 1;
}
nbsd_init(struct pci_access *a)
{
char *name = a->method_params[PCI_ACCESS_NBSD_LIBPCI];
+ int mode = a->writeable ? O_RDWR : O_RDONLY;
- a->fd = open(name, O_RDWR, 0);
+ a->fd = open(name, mode, 0);
if (a->fd < 0)
a->error("nbsd_init: %s open failed", name);
}