]> andersk Git - openssh.git/blobdiff - ssh-agent.c
- deraadt@cvs.openbsd.org 2001/03/06 00:33:04
[openssh.git] / ssh-agent.c
index a558ecef7d6b9776176962aaf41a21af5ca044ec..5a774d57029aa97d8ed6f336de0ef3e2086b2bbb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ssh-agent.c,v 1.51 2001/03/02 18:54:31 deraadt Exp $  */
+/*     $OpenBSD: ssh-agent.c,v 1.52 2001/03/06 00:33:04 deraadt Exp $  */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.51 2001/03/02 18:54:31 deraadt Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.52 2001/03/06 00:33:04 deraadt Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/md5.h>
@@ -635,9 +635,15 @@ after_select(fd_set *readset, fd_set *writeset)
                case AUTH_CONNECTION:
                        if (buffer_len(&sockets[i].output) > 0 &&
                            FD_ISSET(sockets[i].fd, writeset)) {
-                               len = write(sockets[i].fd,
-                                   buffer_ptr(&sockets[i].output),
-                                   buffer_len(&sockets[i].output));
+                               do {
+                                       len = write(sockets[i].fd,
+                                           buffer_ptr(&sockets[i].output),
+                                           buffer_len(&sockets[i].output));
+                                       if (len == -1 && (errno == EAGAIN ||
+                                           errno == EINTR))
+                                               continue;
+                                       break;
+                               } while (1);
                                if (len <= 0) {
                                        shutdown(sockets[i].fd, SHUT_RDWR);
                                        close(sockets[i].fd);
@@ -649,7 +655,13 @@ after_select(fd_set *readset, fd_set *writeset)
                                buffer_consume(&sockets[i].output, len);
                        }
                        if (FD_ISSET(sockets[i].fd, readset)) {
-                               len = read(sockets[i].fd, buf, sizeof(buf));
+                               do {
+                                       len = read(sockets[i].fd, buf, sizeof(buf));
+                                       if (len == -1 && (errno == EAGAIN ||
+                                           errno == EINTR))
+                                               continue;
+                                       break;
+                               } while (1);
                                if (len <= 0) {
                                        shutdown(sockets[i].fd, SHUT_RDWR);
                                        close(sockets[i].fd);
This page took 0.035363 seconds and 4 git commands to generate.