diff options
author | 1999-10-26 04:27:14 +0000 | |
---|---|---|
committer | 1999-10-26 04:27:14 +0000 | |
commit | 406891bd852b21f4a6469bac735795902e2893dc (patch) | |
tree | 5d83217a5353ef4f097e2eb4f222a029a082cefb /pw/grupd.c | |
parent | e8f6c5579cf8419e33bbcba0ceef55b1cdc34145 (diff) | |
download | pw-darwin-406891bd852b21f4a6469bac735795902e2893dc.tar.gz pw-darwin-406891bd852b21f4a6469bac735795902e2893dc.tar.zst pw-darwin-406891bd852b21f4a6469bac735795902e2893dc.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); |