]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pw_group.c
Allow negative numbers in -u and -g options
[pw-darwin.git] / pw / pw_group.c
index b20ce88fb3014c6f9cbaddfe6e650569ecbb8cb4..51166cdebca504d31f2c03cd5a92ef32604a86da 100644 (file)
@@ -68,7 +68,11 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
        };
 
        if (a_gid != NULL) {
-               if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val))
+               const char *teststr;
+               teststr = a_gid->val;
+               if (*teststr == '-')
+                       teststr++;
+               if (strspn(teststr, "0123456789") != strlen(teststr))
                        errx(EX_USAGE, "-g expects a number");
        }