summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/grupd.c
diff options
context:
space:
mode:
authordavidn <davidn@FreeBSD.org>1999-10-26 04:27:14 +0000
committerdavidn <davidn@FreeBSD.org>1999-10-26 04:27:14 +0000
commit7f7ff280d14b2c60d92e922c66eb7f433fb633ce (patch)
tree668b7aa997740786ba3a4ea82d82763d8aabd19b /usr.sbin/pw/grupd.c
parentfeb9306786b253f27c2d97a6a5bed74154eaf59a (diff)
downloadFreeBSD-src-7f7ff280d14b2c60d92e922c66eb7f433fb633ce.zip
FreeBSD-src-7f7ff280d14b2c60d92e922c66eb7f433fb633ce.tar.gz
Clean up error handling in fileupdate(), which now returns 0 on success
instead of a boolean. This replicated through he front-end sub-functions relating to add, delete, modify entries in passwd & group files Errno is now preserved so output of errc()/warnc() will be less obfuscated by subsequent errors when reporting the problem. Add more intelligent error handling when attempting to modify/delete NIS entries with no corresponding local database entry. [MFC to stable in a couple of weeks to keep both in sync]
Diffstat (limited to 'usr.sbin/pw/grupd.c')
-rw-r--r--usr.sbin/pw/grupd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/pw/grupd.c b/usr.sbin/pw/grupd.c
index 237fe95..edff76d 100644
--- a/usr.sbin/pw/grupd.c
+++ b/usr.sbin/pw/grupd.c
@@ -142,8 +142,9 @@ gr_update(struct group * grp, char const * group, int mode)
if (grp != NULL && fmtgrentry(&grbuf, &grbuflen, grp, PWF_PASSWD) == -1)
l = -1;
else {
- if ((l = fileupdate(getgrpath(_GROUP), 0644, grbuf, pfx, l, mode)) != 0)
- l = grdb(NULL) == 0;
+ l = fileupdate(getgrpath(_GROUP), 0644, grbuf, pfx, l, mode);
+ if (l == 0)
+ l = grdb(NULL);
}
if (grbuf != NULL)
free(grbuf);
OpenPOWER on IntegriCloud