diff options
author | David Nugent <davidn@FreeBSD.org> | 1999-10-26 04:27:14 +0000 |
---|---|---|
committer | David Nugent <davidn@FreeBSD.org> | 1999-10-26 04:27:14 +0000 |
commit | a1f21c386dbe541a822f224ae7bdedc71ed3ec70 (patch) | |
tree | d014ed41896e364c56fd8b48ffe4aedbf76acf52 /pw/grupd.c | |
parent | 94dc05fe8b863b3148807bd3c0c9ae4b5a216c39 (diff) | |
download | pw-darwin-a1f21c386dbe541a822f224ae7bdedc71ed3ec70.tar.gz pw-darwin-a1f21c386dbe541a822f224ae7bdedc71ed3ec70.tar.zst pw-darwin-a1f21c386dbe541a822f224ae7bdedc71ed3ec70.zip |
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 'pw/grupd.c')
-rw-r--r-- | pw/grupd.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); |