mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
Use the method described in the strtol man page to check if it parsed
the entire string. This avoids signed/unsigned comparison.
This commit is contained in:
parent
4f1f485f34
commit
fb757ee269
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93432
@ -225,7 +225,7 @@ main(int ac, char **av)
|
||||
}
|
||||
if (user) {
|
||||
uid = strtol(user, &ep, 10);
|
||||
if ((ep - user) < strlen(user)) {
|
||||
if (*user == '\0' || *ep != '\0') { /* was it a number? */
|
||||
pw = getpwnam(user);
|
||||
if (pw == NULL)
|
||||
errx(1, "user %s does not exist", user);
|
||||
|
Loading…
Reference in New Issue
Block a user