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

Sponsored by:	DARPA, NAI Labs
This commit is contained in:
des 2002-05-08 14:52:32 +00:00
parent cb605d9379
commit 0e558b0a7a

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)