X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/4cea479e3670fb11cbc1a0be2a5dde0c7d693afe..36c2926dee21c19894b1c524d8c5a5d389565a48:/usr/src/usr.sbin/vipw/pw_util.c diff --git a/usr/src/usr.sbin/vipw/pw_util.c b/usr/src/usr.sbin/vipw/pw_util.c index 7388649b67..43cc70b55e 100644 --- a/usr/src/usr.sbin/vipw/pw_util.c +++ b/usr/src/usr.sbin/vipw/pw_util.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)pw_util.c 5.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)pw_util.c 5.2 (Berkeley) %G%"; #endif /* not lint */ /* @@ -71,7 +71,7 @@ pw_lock() progname, _PATH_MASTERPASSWD, strerror(errno)); exit(1); } - if (flock(lockfd, LOCK_EX)) { + if (flock(lockfd, LOCK_EX|LOCK_NB)) { (void)fprintf(stderr, "%s: the password db is busy.\n", progname); exit(1); @@ -137,10 +137,11 @@ pw_edit(notsetuid) (void)setuid(getuid()); } execlp(editor, p, tempname, NULL); - pw_error(editor, 1, 1); + _exit(1); } pid = waitpid(pid, (int *)&pstat, 0); - return (pid == -1 ? 1 : pstat.w_status); + if (pid == -1 || pstat.w_status) + pw_error(editor, 1, 1); } pw_prompt()