summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chpass/Makefile6
-rw-r--r--libutil/gr_util.c25
-rw-r--r--pw/Makefile3
3 files changed, 13 insertions, 21 deletions
diff --git a/chpass/Makefile b/chpass/Makefile
index cf3acc6..9b3e878 100644
--- a/chpass/Makefile
+++ b/chpass/Makefile
@@ -16,11 +16,9 @@ CFLAGS+= -DYP
#CFLAGS+=-DRESTRICT_FULLNAME_CHANGE
CFLAGS+=-I${.CURDIR}/../../usr.sbin/pwd_mkdb -I${.CURDIR}/../../lib/libc/gen -I.
-DPADD= ${LIBCRYPT} ${LIBUTIL}
-LDADD= -lcrypt -lutil
+LIBADD= crypt util
.if ${MK_NIS} != "no"
-DPADD+= ${LIBYPCLNT}
-LDADD+= -lypclnt
+LIBADD+= ypclnt
.endif
LINKS= ${BINDIR}/chpass ${BINDIR}/chfn
diff --git a/libutil/gr_util.c b/libutil/gr_util.c
index 465efd9..b0b0b36 100644
--- a/libutil/gr_util.c
+++ b/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/pw/Makefile b/pw/Makefile
index 8c5acf9..269b145 100644
--- a/pw/Makefile
+++ b/pw/Makefile
@@ -8,8 +8,7 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \
WARNS?= 2
-DPADD= ${LIBCRYPT} ${LIBUTIL}
-LDADD= -lcrypt -lutil
+LIBADD= crypt util
.include <src.opts.mk>