X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ls-tree.c;h=cc65ac472097b36d93100e7ba6821ebf873fecfd;hb=ccf5ff415fac5f978a4cd5d6ada1ca1846cf201b;hp=fede581156e4d288759f3809bf467f2b3af37d89;hpb=67954c8b6514859a0e115538200187f3a1ffd366;p=pciutils.git diff --git a/ls-tree.c b/ls-tree.c index fede581..cc65ac4 100644 --- a/ls-tree.c +++ b/ls-tree.c @@ -107,7 +107,7 @@ grow_tree(void) { struct pci_dev *dd = d->dev; word class = dd->device_class; - byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; + byte ht = d->no_config_access ? -1 : (get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f); if ((class >> 8) == PCI_BASE_CLASS_BRIDGE && (ht == PCI_HEADER_TYPE_BRIDGE || ht == PCI_HEADER_TYPE_CARDBUS)) { @@ -239,7 +239,11 @@ tree_printf(char *line, char *p, char *fmt, ...) p += space; } else if (res >= space) - p += space; + { + /* Ancient C libraries do not truncate the output properly. */ + *(p+space-1) = 0; + p += space; + } else p += res; @@ -258,7 +262,9 @@ show_tree_dev(struct device *d, char *line, char *p) for (b=&host_bridge; b; b=b->chain) if (b->br_dev == d) { - if (b->secondary == b->subordinate) + if (b->secondary == 0) + p = tree_printf(line, p, "-"); + else if (b->secondary == b->subordinate) p = tree_printf(line, p, "-[%02x]-", b->secondary); else p = tree_printf(line, p, "-[%02x-%02x]-", b->secondary, b->subordinate);