]> granicus.if.org Git - sudo/commitdiff
select() may return EAGAIN. If so, continue like we do for EINTR.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 13 Apr 2001 01:42:50 +0000 (01:42 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 13 Apr 2001 01:42:50 +0000 (01:42 +0000)
tgetpass.c

index 56253392c37045627ea3c45af4e672b89774ad01..184688c20ddcf18909cfcce35456cc70b9e0e883 100644 (file)
@@ -195,10 +195,12 @@ tgetline(fd, buf, bufsiz, timeout)
 
            /* Make sure there is something to read (or timeout) */
            while ((n = select(fd + 1, readfds, 0, 0, &tv)) == -1 &&
-               errno == EINTR)
+               (errno == EINTR || errno == EAGAIN))
                ;
-           if (n == 0)
+           if (n == 0) {
+               free(readfds);
                return(NULL);           /* timeout */
+           }
 
            /* Read a character, exit loop on error, EOF or EOL */
            n = read(fd, &c, 1);