=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/chpass/chpass.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/chpass/chpass.c 2001/08/16 18:29:27 1.19 --- src/usr.bin/chpass/chpass.c 2001/08/27 02:57:07 1.20 *************** *** 1,4 **** ! /* $OpenBSD: chpass.c,v 1.19 2001/08/16 18:29:27 millert Exp $ */ /* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: chpass.c,v 1.20 2001/08/27 02:57:07 millert Exp $ */ /* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */ /*- *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94"; #else ! static char rcsid[] = "$OpenBSD: chpass.c,v 1.19 2001/08/16 18:29:27 millert Exp $"; #endif #endif /* not lint */ --- 44,50 ---- #if 0 static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94"; #else ! static char rcsid[] = "$OpenBSD: chpass.c,v 1.20 2001/08/27 02:57:07 millert Exp $"; #endif #endif /* not lint */ *************** *** 54,60 **** #include #include - #include #include #include #include --- 54,59 ---- *************** *** 94,102 **** char **argv; { struct passwd *pw, lpw; ! int ch, pfd, tfd, dfd; char *arg; - char *s = NULL; sigset_t fullset; #ifdef YP --- 93,100 ---- char **argv; { struct passwd *pw, lpw; ! int i, ch, pfd, tfd, dfd; char *arg; sigset_t fullset; #ifdef YP *************** *** 203,243 **** /* Get the passwd lock file and open the passwd file for reading. */ pw_init(); ! for (;;) { ! int i, c, d; ! ! for (i = 0; i < (s ? 64 : 8) && (tfd = pw_lock(0)) == -1; i++) { ! if (i == 0) ! (void)fputs("Please wait", stderr); ! (void)signal(SIGINT, kbintr); ! fputc('.', stderr); ! usleep(250000); ! (void)signal(SIGINT, SIG_IGN); ! } ! if (i) ! fputc('\n', stderr); ! if (tfd != -1) ! break; ! ! /* Unable to lock passwd file, let the user decide. */ ! if (errno == EEXIST) { ! if (s == NULL) ! s = "The passwd file is busy,"; ! else ! s = "The passwd file is still busy,"; ! } else ! s = "Unable to open passwd temp file,"; ! (void)fprintf(stderr, ! "%s do you want to wait until it is available? [y/n] ", s); (void)signal(SIGINT, kbintr); ! c = getchar(); (void)signal(SIGINT, SIG_IGN); - if (c != '\n') - while ((d = getchar()) != '\n' && d != EOF) - ; - if (tolower(c) != 'y') - pw_error(NULL, 0, 1); } pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0); if (pfd == -1 || fcntl(pfd, F_SETFD, 1) == -1) pw_error(_PATH_MASTERPASSWD, 1, 1); --- 201,218 ---- /* Get the passwd lock file and open the passwd file for reading. */ pw_init(); ! for (i = 1; (tfd = pw_lock(0)) == -1; i++) { ! if (i == 4) ! (void)fputs("Attempting lock password file, " ! "please wait or press ^C to abort", stderr); (void)signal(SIGINT, kbintr); ! if (i % 16 == 0) ! fputc('.', stderr); ! usleep(250000); (void)signal(SIGINT, SIG_IGN); } + if (i >= 4) + fputc('\n', stderr); pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0); if (pfd == -1 || fcntl(pfd, F_SETFD, 1) == -1) pw_error(_PATH_MASTERPASSWD, 1, 1);