summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-07-29 06:22:41 +0000
committerbapt <bapt@FreeBSD.org>2015-07-29 06:22:41 +0000
commit4eb9f59af4f0e049f164c1dfd78a3f515aea90d2 (patch)
tree98a84b8a96d7783adc54c37bc04004d79098fd05 /usr.sbin/pw/pw.c
parentb7b72de7da1bacfaf7e37fed7943715dd342af86 (diff)
downloadFreeBSD-src-4eb9f59af4f0e049f164c1dfd78a3f515aea90d2.zip
FreeBSD-src-4eb9f59af4f0e049f164c1dfd78a3f515aea90d2.tar.gz
Create a strtounum function using the same API as strtonum
This function returns uintmax_t Use this function to convert to gid_t/uid_t
Diffstat (limited to 'usr.sbin/pw/pw.c')
-rw-r--r--usr.sbin/pw/pw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c
index c1d9cd3..88c83db 100644
--- a/usr.sbin/pw/pw.c
+++ b/usr.sbin/pw/pw.c
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
cmdhelp(mode, which);
else if (which != -1 && mode != -1) {
if (strspn(argv[1], "0123456789") == strlen(argv[1])) {
- id = strtonum(argv[1], 0, LONG_MAX, &errstr);
+ id = strtounum(argv[1], 0, UID_MAX, &errstr);
if (errstr != NULL)
errx(EX_USAGE, "Bad id '%s': %s",
argv[1], errstr);
@@ -269,7 +269,7 @@ main(int argc, char *argv[])
}
if (strspn(optarg, "0123456789") != strlen(optarg))
errx(EX_USAGE, "-g expects a number");
- id = strtonum(optarg, 0, GID_MAX, &errstr);
+ id = strtounum(optarg, 0, GID_MAX, &errstr);
if (errstr != NULL)
errx(EX_USAGE, "Bad id '%s': %s", optarg,
errstr);
@@ -281,7 +281,7 @@ main(int argc, char *argv[])
addarg(&arglist, 'u', optarg);
break;
}
- id = strtonum(optarg, 0, UID_MAX, &errstr);
+ id = strtounum(optarg, 0, UID_MAX, &errstr);
if (errstr != NULL)
errx(EX_USAGE, "Bad id '%s': %s", optarg,
errstr);
OpenPOWER on IntegriCloud