mgetgroups: reduce duplicate listings
POSIX doesn't guarantee whether the effective gid is included in
the list of supplementary groups returned by getgroups. On the
other hand, some platforms include the effective gid twice in
the list. Meanwhile, mgetgroups can independently add a duplicate.
Rather than spend a full-blown O(n log n) cleanup, we just remove
the most common forms of duplicate groups with an O(n) pass.
* lib/mgetgroups.c (mgetgroups): Reduce duplicates from the
resulting array.
* tests/test-chown.h (test_chown): Simplify client.
* tests/test-lchown.h (test_lchown): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>