safe_fork(): trap EINTR on pipe read
authorFrank Cusack <fcusack@fcusack.com>
Tue, 4 Mar 2003 05:37:22 +0000 (05:37 +0000)
committerFrank Cusack <fcusack@fcusack.com>
Tue, 4 Mar 2003 05:37:22 +0000 (05:37 +0000)
pppd/main.c

index a01b852cc26c1dad05dabd37dcdecb5694694aa3..7b57a2a570e6c771f2909f4c024ec3c5c93e9ba1 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: main.c,v 1.123 2003/03/03 05:11:46 paulus Exp $"
+#define RCSID  "$Id: main.c,v 1.124 2003/03/04 05:37:22 fcusack Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -1428,7 +1428,9 @@ safe_fork()
        if (pid > 0) {
                close(pipefd[1]);
                /* this read() blocks until the close(pipefd[1]) below */
-               read(pipefd[0], buf, 1);
+               while (read(pipefd[0], buf, 1) < 0)
+                   if (errno != EINTR)
+                       break;
                close(pipefd[0]);
                return pid;
        }