Changeset 301 in openpam for trunk


Ignore:
Timestamp:
Feb 1, 2005, 12:00:02 PM (14 years ago)
Author:
Dag-Erling Smørgrav
Message:

Leave alarm() alone if openpam_ttyconv_timeout is zero or negative.
Also bobbit an unused variable.

Obtained from: NetBSD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_ttyconv.c

    r288 r301  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#25 $
     34 * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#26 $
    3535 */
    3636
     
    6767        sigset_t saved_sigset, sigset;
    6868        unsigned int saved_alarm;
    69         int eof, error, fd, timed_out;
     69        int eof, error, fd;
    7070        size_t len;
    7171        char *retval;
     
    8787        fd = fileno(stdin);
    8888        buf[0] = '\0';
    89         timed_out = 0;
    90         eof = error = timed_out = 0;
    91         saved_alarm = alarm(openpam_ttyconv_timeout);
     89        eof = error = 0;
     90        if (openpam_ttyconv_timeout >= 0)
     91                saved_alarm = alarm(openpam_ttyconv_timeout);
    9292        ch = '\0';
    9393        for (len = 0; ch != '\n' && !eof && !error; ++len) {
     
    107107                }
    108108        }
    109         alarm(0);
     109        if (openpam_ttyconv_timeout >= 0)
     110                alarm(0);
    110111        sigaction(SIGALRM, &saved_action, NULL);
    111112        sigprocmask(SIG_SETMASK, &saved_sigset, NULL);
    112         alarm(saved_alarm);
     113        if (openpam_ttyconv_timeout >= 0)
     114                alarm(saved_alarm);
    113115        if (error == EINTR)
    114116                fputs(" timeout!", stderr);
Note: See TracChangeset for help on using the changeset viewer.