summaryrefslogtreecommitdiffstats
path: root/usr.sbin/edquota
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-08-09 01:21:03 +0000
committeriedowse <iedowse@FreeBSD.org>2002-08-09 01:21:03 +0000
commit99ddd54c1fccd36c0210cfba122551ef501333da (patch)
tree1115cf806fd661c968032ce6303844ef0d9a6691 /usr.sbin/edquota
parent6e02be778087979a6673a8421ec064509b9a5e51 (diff)
downloadFreeBSD-src-99ddd54c1fccd36c0210cfba122551ef501333da.zip
FreeBSD-src-99ddd54c1fccd36c0210cfba122551ef501333da.tar.gz
Improve the code for detecting UID ranges so that usernames such
as "2-xhibit" are not considered as a range. Fix a problem where the code would forget to increment argv. PR: misc/15658
Diffstat (limited to 'usr.sbin/edquota')
-rw-r--r--usr.sbin/edquota/edquota.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index e7be4b7..0e1a988 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -147,8 +147,8 @@ main(int argc, char **argv)
qup->dqblk.dqb_btime = 0;
qup->dqblk.dqb_itime = 0;
}
- while (argc-- > 0) {
- if (isdigit(*argv[0]) &&
+ for (; argc-- > 0; argv++) {
+ if (strspn(*argv, "0123456789-") == strlen(*argv) &&
(cp = strchr(*argv, '-')) != NULL) {
*cp++ = '\0';
startuid = atoi(*argv);
@@ -166,7 +166,7 @@ main(int argc, char **argv)
}
continue;
}
- if ((id = getentry(*argv++, quotatype)) < 0)
+ if ((id = getentry(*argv, quotatype)) < 0)
continue;
putprivs(id, quotatype, protoprivs);
}
OpenPOWER on IntegriCloud