Only do a full pwd_mkdb for deletions; other operations may use the -u

option as an optimization.

PR:	13346
Submitted by:	Neil Blakey-Milner <nbm@rucus.ru.ac.za>
This commit is contained in:
Sheldon Hearn 1999-08-30 10:35:38 +00:00
parent c5b72c3d85
commit 8ca1dc4b47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50653

View File

@ -168,8 +168,12 @@ pw_update(struct passwd * pwd, char const * user, int mode)
*/
if (pwd != NULL)
fmtpwentry(pwbuf, pwd, PWF_MASTER);
if ((rc = fileupdate(getpwpath(_MASTERPASSWD), 0644, pwbuf, pfx, l, mode)) != 0)
rc = pwdb(NULL) == 0;
if ((rc = fileupdate(getpwpath(_MASTERPASSWD), 0644, pwbuf, pfx, l, mode)) != 0) {
if (mode == UPD_DELETE)
rc = pwdb(NULL) == 0;
else
rc = pwdb("-u", user, NULL) == 0;
}
}
}
return rc;