summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pciconf
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pciconf')
-rw-r--r--usr.sbin/pciconf/pciconf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 764fd3d..0dc9dcc 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -425,9 +425,17 @@ load_vendors(void)
static struct pcisel
getsel(const char *str)
{
- char *ep = (char*) str;
+ char *ep = strchr(str, '@');
+ char *epbase;
struct pcisel sel;
-
+
+ if (ep == NULL)
+ ep = (char *)str;
+ else
+ ep++;
+
+ epbase = ep;
+
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
sel.pc_bus = strtoul(ep, &ep, 0);
@@ -440,10 +448,10 @@ getsel(const char *str)
ep++;
sel.pc_func = strtoul(ep, &ep, 0);
}
+ if (*ep == ':')
+ ep++;
}
- if (*ep == ':')
- ep++;
- if (*ep || ep == str)
+ if (*ep != '\x0' || ep == epbase)
errx(1, "cannot parse selector %s", str);
return sel;
}
OpenPOWER on IntegriCloud