Subject: bin/3808: Fix to chpass patch of 970628
To: None <gnats-bugs@gnats.netbsd.org>
From: Data In~rte~vgri}ity EnginNO CARRIER <greywolf@starwolf.com>
List: netbsd-bugs
Date: 06/28/1997 14:40:58
>Number: 3808
>Category: bin
>Synopsis: Previous patch faulty
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Jun 28 14:50:03 1997
>Last-Modified:
>Originator: Grey Wolf
>Organization:
Star Wolf Innovations
>Release: 1.2
>Environment:
System: NetBSD starwolf.starwolf.com 1.2E NetBSD 1.2E (STARWOLF) #8: Wed Jun 4 01:11:20 PDT 1997 root@starwolf.starwolf.com:/usr/src/sys/arch/sparc/compile/STARWOLF sparc
>Description:
This patch supercedes the chpass.c patch submitted 970628-1400
>How-To-Repeat:
n/a
>Fix:
*** chpass.c Sat Jun 28 14:38:22 1997
--- chpass.c.orig Sat Jun 28 01:25:32 1997
***************
*** 227,232 ****
--- 227,235 ----
* reading.
*/
pw_init();
+ tfd = pw_lock(0);
+ if (tfd < 0)
+ errx(1, "the passwd file is busy.");
pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
if (pfd < 0)
pw_error(_PATH_MASTERPASSWD, 1, 1);
***************
*** 250,268 ****
else
exit(0);
}
! else {
#endif /* YP */
- /* moved here from after pw_init */
- tfd = pw_lock(0);
- if (tfd < 0)
- errx(1, "the passwd file is busy.");
/* Copy the passwd file to the lock file, updating pw. */
pw_copy(pfd, tfd, pw);
- #ifdef YP
- }
- #endif
/* Now finish the passwd file update. */
if (pw_mkdb() < 0)
pw_error((char *)NULL, 0, 1);
--- 253,264 ----
else
exit(0);
}
! else
#endif /* YP */
/* Copy the passwd file to the lock file, updating pw. */
pw_copy(pfd, tfd, pw);
/* Now finish the passwd file update. */
if (pw_mkdb() < 0)
pw_error((char *)NULL, 0, 1);
>Audit-Trail:
>Unformatted: