From 406891bd852b21f4a6469bac735795902e2893dc Mon Sep 17 00:00:00 2001 From: David Nugent Date: Tue, 26 Oct 1999 04:27:14 +0000 Subject: 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] --- pw/grupd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pw/grupd.c') diff --git a/pw/grupd.c b/pw/grupd.c index 237fe95..edff76d 100644 --- a/pw/grupd.c +++ b/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); -- cgit v1.2.3