summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2004-07-09 19:30:53 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2004-07-09 19:30:53 +0000
commit0b62c8fac189b299774affb318fabf604e1dbf22 (patch)
tree2676e003ea2dc798d2d03c6ac5392177450d9b1d /usr.sbin
parent1b05b51fd79f68f9807bec5448871081c86a65af (diff)
[From: Joris Vink]
Use strtonum(3) instead of strtol(3). ok deraadt@ & me
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/procmap/procmap.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c
index 8b91d443a26..a6266391789 100644
--- a/usr.sbin/procmap/procmap.c
+++ b/usr.sbin/procmap/procmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procmap.c,v 1.16 2004/04/01 23:17:11 tdeval Exp $ */
+/* $OpenBSD: procmap.c,v 1.17 2004/07/09 19:30:52 tdeval Exp $ */
/* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */
/*
@@ -970,14 +970,11 @@ usage(void)
static pid_t
strtopid(const char *str)
{
- unsigned long pid;
- char *endptr;
+ pid_t pid;
errno = 0;
- pid = strtoul(str, &endptr, 10);
- if (str[0] == '\0' || *endptr != '\0')
- usage();
- if (errno == ERANGE && pid == ULONG_MAX)
+ pid = (pid_t)strtonum(str, 0, INT_MAX, NULL);
+ if (errno != 0)
usage();
return (pid);
}