From 80a23c5363fbf64cd4420edd462e23d89b3e8a39 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 24 Jan 2015 19:13:03 +0000 Subject: Allow negative numbers in -u and -g options PR: 196514 MFC after: 1 week --- pw/pw_user.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pw/pw_user.c') 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"); } -- cgit v1.2.3