summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-01-24 19:13:03 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-01-24 19:13:03 +0000
commit781a5b787624a2cd0208bf63bc1c0572e182a306 (patch)
treef71f92f914ca8bb490ff0c9a7db9c78426deb3bd /pw/pw_user.c
parent9d27d4e8bf692d371fe7363d3e4b6613c5a8881a (diff)
downloadpw-darwin-781a5b787624a2cd0208bf63bc1c0572e182a306.tar.gz
pw-darwin-781a5b787624a2cd0208bf63bc1c0572e182a306.tar.zst
pw-darwin-781a5b787624a2cd0208bf63bc1c0572e182a306.zip
Allow negative numbers in -u and -g options
PR: 196514 MFC after: 1 week
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r--pw/pw_user.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 483148a..f146b46 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -322,7 +322,10 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
a_name = NULL;
}
} else {
- if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val))
+ const char *teststr = a_uid->val;
+ if (*teststr == '-')
+ teststr++;
+ if (strspn(teststr, "0123456789") != strlen(teststr))
errx(EX_USAGE, "-u expects a number");
}