diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 65145fa4c81da358fcbc3b650156dab705dfa34e (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /lib/libutil | |
parent | 60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff) | |
parent | e6b664c390af88d4a87208bc042ce503da664c3b (diff) | |
download | FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz |
Merge sync of head
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/gr_util.c | 25 | ||||
-rw-r--r-- | lib/libutil/quotafile.3 | 4 | ||||
-rw-r--r-- | lib/libutil/tests/Makefile | 3 |
3 files changed, 13 insertions, 19 deletions
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c index 465efd9..b0b0b36f 100644 --- a/lib/libutil/gr_util.c +++ b/lib/libutil/gr_util.c @@ -351,8 +351,6 @@ gr_fini(void) int gr_equal(const struct group *gr1, const struct group *gr2) { - int gr1_ndx; - int gr2_ndx; /* Check that the non-member information is the same. */ if (gr1->gr_name == NULL || gr2->gr_name == NULL) { @@ -368,7 +366,8 @@ gr_equal(const struct group *gr1, const struct group *gr2) if (gr1->gr_gid != gr2->gr_gid) return (false); - /* Check all members in both groups. + /* + * Check all members in both groups. * getgrnam can return gr_mem with a pointer to NULL. * gr_dup and gr_add strip out this superfluous NULL, setting * gr_mem to NULL for no members. @@ -376,22 +375,18 @@ gr_equal(const struct group *gr1, const struct group *gr2) if (gr1->gr_mem != NULL && gr2->gr_mem != NULL) { int i; - for (i = 0; gr1->gr_mem[i] != NULL; i++) { + for (i = 0; + gr1->gr_mem[i] != NULL && gr2->gr_mem[i] != NULL; i++) { if (strcmp(gr1->gr_mem[i], gr2->gr_mem[i]) != 0) return (false); } - } - /* Count number of members in both structs */ - gr2_ndx = 0; - if (gr2->gr_mem != NULL) - for(; gr2->gr_mem[gr2_ndx] != NULL; gr2_ndx++) - /* empty */; - gr1_ndx = 0; - if (gr1->gr_mem != NULL) - for(; gr1->gr_mem[gr1_ndx] != NULL; gr1_ndx++) - /* empty */; - if (gr1_ndx != gr2_ndx) + if (gr1->gr_mem[i] != NULL || gr2->gr_mem[i] != NULL) + return (false); + } else if (gr1->gr_mem != NULL && gr1->gr_mem[0] != NULL) { return (false); + } else if (gr2->gr_mem != NULL && gr2->gr_mem[0] != NULL) { + return (false); + } return (true); } diff --git a/lib/libutil/quotafile.3 b/lib/libutil/quotafile.3 index 001a66c..362cf01 100644 --- a/lib/libutil/quotafile.3 +++ b/lib/libutil/quotafile.3 @@ -273,8 +273,8 @@ and set to indicate the error. .Sh SEE ALSO .Xr quotactl 2 , -.Xr quota.user 5 , -.Xr quota.group 5 +.Xr quota.group 5 , +.Xr quota.user 5 .Sh HISTORY The .Nm quotafile diff --git a/lib/libutil/tests/Makefile b/lib/libutil/tests/Makefile index 31b6c54..36eb2ae 100644 --- a/lib/libutil/tests/Makefile +++ b/lib/libutil/tests/Makefile @@ -9,7 +9,6 @@ TAP_TESTS_C+= pidfile_test TAP_TESTS_C+= trimdomain_test TAP_TESTS_C+= trimdomain-nodomain_test -DPADD+= ${LIBUTIL} -LDADD+= -lutil +LIBADD+= util .include <bsd.test.mk> |