]> mj.ucw.cz Git - pciutils.git/blobdiff - ls-tree.c
cxl: Rename caps to be device caps
[pciutils.git] / ls-tree.c
index f8154a2b034a67a3b22dd4eb2e5da82d542256d2..cc65ac472097b36d93100e7ba6821ebf873fecfd 100644 (file)
--- 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;