Date: Tue, 1 Feb 2005 11:00:31 GMT From: Dag-Erling Smorgrav <des@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 70082 for review Message-ID: <200502011100.j11B0VIt040289@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=70082 Change 70082 by des@des.at.des.thinksec.com on 2005/02/01 11:00:02 Leave alarm() alone if openpam_ttyconv_timeout is zero or negative. Also bobbit an unused variable. Obtained from: NetBSD Affected files ... .. //depot/projects/openpam/lib/openpam_ttyconv.c#26 edit Differences ... ==== //depot/projects/openpam/lib/openpam_ttyconv.c#26 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#25 $ + * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#26 $ */ #include <sys/types.h> @@ -66,7 +66,7 @@ struct sigaction action, saved_action; sigset_t saved_sigset, sigset; unsigned int saved_alarm; - int eof, error, fd, timed_out; + int eof, error, fd; size_t len; char *retval; char ch; @@ -86,9 +86,9 @@ #endif fd = fileno(stdin); buf[0] = '\0'; - timed_out = 0; - eof = error = timed_out = 0; - saved_alarm = alarm(openpam_ttyconv_timeout); + eof = error = 0; + if (openpam_ttyconv_timeout >= 0) + saved_alarm = alarm(openpam_ttyconv_timeout); ch = '\0'; for (len = 0; ch != '\n' && !eof && !error; ++len) { switch (read(fd, &ch, 1)) { @@ -106,10 +106,12 @@ break; } } - alarm(0); + if (openpam_ttyconv_timeout >= 0) + alarm(0); sigaction(SIGALRM, &saved_action, NULL); sigprocmask(SIG_SETMASK, &saved_sigset, NULL); - alarm(saved_alarm); + if (openpam_ttyconv_timeout >= 0) + alarm(saved_alarm); if (error == EINTR) fputs(" timeout!", stderr); if (error || eof) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502011100.j11B0VIt040289>