about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-18 10:12:37 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-18 10:12:37 +0000
commit039c1b75276118560dae730b033261a1ae8df7fa (patch)
tree60a177af1f3c1ab6f8f79a6f0c89952eaa72a7b6 /inet
parente76afb7be1dbbd9337901dee42569c495ffa32ba (diff)
downloadglibc-039c1b75276118560dae730b033261a1ae8df7fa.tar.gz
glibc-039c1b75276118560dae730b033261a1ae8df7fa.tar.xz
glibc-039c1b75276118560dae730b033261a1ae8df7fa.zip
Update.
2003-01-18  Ulrich Drepper  <drepper@redhat.com>

	* inet/rexec.c (rexec_af): Protect socket operations with
	TEMP_FAILURE_RETRY.  Use writev instead of multiple write.
	* inet/rcmd.c (rcmd_af): Likewise.
Diffstat (limited to 'inet')
-rw-r--r--inet/rexec.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/inet/rexec.c b/inet/rexec.c
index c6b432a6f8..3c14836aa2 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)rexec.c	8.1 (Berkeley) 6/4/93";
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/uio.h>
 
 int	rexecoptions;
 libc_freeres_ptr (static char *ahostbuf);
@@ -136,7 +137,8 @@ retry:
 		(void) sprintf(num, "%u", port);
 		(void) __write(s, num, strlen(num)+1);
 		{ int len = sizeof (from);
-		  s3 = accept(s2, (struct sockaddr *)&from, &len);
+		  s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
+						  &len));
 		  __close(s2);
 		  if (s3 < 0) {
 			perror("accept");
@@ -146,10 +148,15 @@ retry:
 		}
 		*fd2p = s3;
 	}
-	(void) __write(s, name, strlen(name) + 1);
-	/* should public key encypt the password here */
-	(void) __write(s, pass, strlen(pass) + 1);
-	(void) __write(s, cmd, strlen(cmd) + 1);
+
+	struct iovec iov[3] =
+	  {
+	    [0] = { .iov_base = (void *) name, .iov_len = strlen (name) + 1 },
+	    /* should public key encypt the password here */
+	    [1] = { .iov_base = (void *) pass, .iov_len = strlen (pass) + 1 },
+	    [2] = { .iov_base = (void *) cmd, .iov_len = strlen (cmd) + 1 }
+	  };
+	(void) TEMP_FAILURE_RETRY (__writev (s, iov, 3));
 
 	/* We don't need the memory allocated for the name and the password
 	   in ruserpass anymore.  */