diff options
author | Pádraig Brady <P@draigBrady.com> | 2013-09-20 03:51:27 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2013-09-21 16:30:58 +0100 |
commit | 798e9bc8b86c1032105682771539bae4ea1e9128 (patch) | |
tree | f327ec097f3a9a95758d0fdfd6ee852a80df7d6e /tests | |
parent | cf0e1bcdc666748ef2bcb38f806cac432936090d (diff) | |
download | gnulib-798e9bc8b86c1032105682771539bae4ea1e9128.tar.gz |
userspec: support optional parameters to parse_user_spec()
* lib/userspec.c (parse_user_spec): If the GID param is NULL,
then avoid group processing and treat the full spec as a user.
(parse_with_separator): Allow the USERNAME and GROUPNAME to
be optional params (NULL), in which case they're ignored.
* tests/test-userspec.c (main): Ensure NULL params are ignored.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-userspec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test-userspec.c b/tests/test-userspec.c index 5b0266485a..8e3672f597 100644 --- a/tests/test-userspec.c +++ b/tests/test-userspec.c @@ -181,6 +181,17 @@ main (void) } } + /* Ensure NULL parameters are ignored. */ + { + uid_t uid = (uid_t) -1; + char const *diag = parse_user_spec ("", &uid, NULL, NULL, NULL); + if (diag) + { + printf ("unexpected error: %s\n", diag); + fail = 1; + } + } + return fail; } |