aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pciconf/pciconf.c
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2016-02-18 15:23:25 +0000
committerStefan Eßer <se@FreeBSD.org>2016-02-18 15:23:25 +0000
commita4ed9e4f78048517a2f31aab3c4a425bd609b66a (patch)
tree84964f73ff2dcbdea474c4dee504baac7a0ff221 /usr.sbin/pciconf/pciconf.c
parent787db28adf2ab740c0627ab4f789a5224bf984ad (diff)
downloadsrc-a4ed9e4f78048517a2f31aab3c4a425bd609b66a.tar.gz
src-a4ed9e4f78048517a2f31aab3c4a425bd609b66a.zip
Make WARNS=6 safe.
Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.
Notes
Notes: svn path=/head/; revision=295760
Diffstat (limited to 'usr.sbin/pciconf/pciconf.c')
-rw-r--r--usr.sbin/pciconf/pciconf.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 194da6b3d9e8..85b5e870fed7 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -67,7 +67,7 @@ struct pci_vendor_info
char *desc;
};
-TAILQ_HEAD(,pci_vendor_info) pci_vendors;
+static TAILQ_HEAD(,pci_vendor_info) pci_vendors;
static struct pcisel getsel(const char *str);
static void list_bridge(int fd, struct pci_conf *p);
@@ -896,16 +896,18 @@ getdevice(const char *name)
static struct pcisel
parsesel(const char *str)
{
- char *ep = strchr(str, '@');
- char *epbase;
+ const char *ep;
+ const char *epbase;
+ char *eppos;
struct pcisel sel;
unsigned long selarr[4];
int i;
- if (ep == NULL)
- ep = (char *)str;
- else
+ ep = strchr(str, '@');
+ if (ep != NULL)
ep++;
+ else
+ ep = str;
epbase = ep;
@@ -913,7 +915,8 @@ parsesel(const char *str)
ep += 3;
i = 0;
do {
- selarr[i++] = strtoul(ep, &ep, 10);
+ selarr[i++] = strtoul(ep, &eppos, 10);
+ ep = eppos;
} while ((*ep == ':' || *ep == '.') && *++ep != '\0' && i < 4);
if (i > 2)