If no old_pw was passed to pw_copy, compare just the name.

Sponsored by:	DARPA, NAI Labs
This commit is contained in:
Dag-Erling Smørgrav 2002-05-08 14:52:32 +00:00
parent 0081eff379
commit 95ed2ab27f

View File

@ -458,7 +458,8 @@ pw_copy(int ffd, int tfd, struct passwd *pw, struct passwd *old_pw)
*q = '\0';
fpw = pw_scan(r, PWSCAN_MASTER);
*q = t;
if (old_pw == NULL || !pw_equal(pw, old_pw)) {
if ((old_pw && !pw_equal(fpw, old_pw)) ||
(!old_pw && strcmp(fpw->pw_name, pw->pw_name))) {
/* nope */
free(fpw);
if (write(tfd, p, q - p + 1) != q - p + 1)