summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-07-16 14:39:28 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-07-16 14:39:28 +0000
commit774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c (patch)
tree0aaa1fdbbd5c4a7d82cc2350075f5172a57bf1c5
parent182180131a287ce1ad671222d8a1708ebd145bae (diff)
downloadldetect-774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c.tar
ldetect-774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c.tar.gz
ldetect-774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c.tar.bz2
ldetect-774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c.tar.xz
ldetect-774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c.zip
don't do useless stuff when full probe isn't requires:
- allocatestuff on stack - call snprintf
-rw-r--r--pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pci.c b/pci.c
index 6787977..1ed5c96 100644
--- a/pci.c
+++ b/pci.c
@@ -27,11 +27,11 @@ extern struct pciusb_entries pci_probe(int probe_type) {
e.pci_bus = devbusfn >> 8;
e.pci_device = (devbusfn & 0xff) >> 3;
e.pci_function = (devbusfn & 0xff) & 0x07;
- {
+ if (probe_type == 1) {
char file[25];
FILE *f;
snprintf(file, sizeof(file), "/proc/bus/pci/%02x/%02x.%d", e.pci_bus, e.pci_device, e.pci_function);
- if (probe_type == 1 && (f = fopen(file, "r"))) {
+ if ((f = fopen(file, "r"))) {
if (fseek(f, 10, SEEK_SET) == 0)
fread(&e.class_, 2, 1, f);
if (fseek(f, 0x2c, SEEK_SET) == 0)