6263984 zlogin's i/o loop can sometimes drop data on child death onnv_50
authordp
Mon, 02 Oct 2006 16:12:28 -0700
changeset 2852 3395d6ba9de2
parent 2851 aaf35d5f6e35
child 2853 7064ad681ecc
6263984 zlogin's i/o loop can sometimes drop data on child death
usr/src/cmd/zlogin/zlogin.c
--- a/usr/src/cmd/zlogin/zlogin.c	Mon Oct 02 16:11:51 2006 -0700
+++ b/usr/src/cmd/zlogin/zlogin.c	Mon Oct 02 16:12:28 2006 -0700
@@ -114,6 +114,8 @@
 #define	DEFAULTSHELL	"/sbin/sh"
 #define	DEF_PATH	"/usr/sbin:/usr/bin"
 
+#define	ZLOGIN_BUFSIZ	8192
+
 /*
  * See canonify() below.  CANONIFY_LEN is the maximum length that a
  * "canonical" sequence will expand to (backslash, three octal digits, NUL).
@@ -620,7 +622,7 @@
 doio(int stdin_fd, int stdout_fd, int stderr_fd, boolean_t raw_mode)
 {
 	struct pollfd pollfds[3];
-	char ibuf[BUFSIZ];
+	char ibuf[ZLOGIN_BUFSIZ];
 	int cc, ret;
 
 	/* read from stdout of zone and write to stdout of global zone */
@@ -657,7 +659,7 @@
 		if (pollfds[0].revents) {
 			if (pollfds[0].revents &
 			    (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
-				cc = read(stdout_fd, ibuf, BUFSIZ);
+				cc = read(stdout_fd, ibuf, ZLOGIN_BUFSIZ);
 				if (cc == -1 && (errno != EINTR || dead))
 					break;
 				if (cc == 0)	/* EOF */
@@ -673,7 +675,7 @@
 		if (pollfds[1].revents) {
 			if (pollfds[1].revents &
 			    (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
-				cc = read(stderr_fd, ibuf, BUFSIZ);
+				cc = read(stderr_fd, ibuf, ZLOGIN_BUFSIZ);
 				if (cc == -1 && (errno != EINTR || dead))
 					break;
 				if (cc == 0)	/* EOF */
@@ -689,7 +691,7 @@
 		if (pollfds[2].revents) {
 			if (pollfds[2].revents &
 			    (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
-				cc = read(STDIN_FILENO, ibuf, BUFSIZ);
+				cc = read(STDIN_FILENO, ibuf, ZLOGIN_BUFSIZ);
 				if (cc == -1 && (errno != EINTR || dead))
 					break;
 
@@ -740,12 +742,12 @@
 	    sizeof (pollfds) / sizeof (struct pollfd), 100);
 	if (pollfds[0].revents &
 	    (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
-		if ((cc = read(stdout_fd, ibuf, BUFSIZ)) > 0)
+		if ((cc = read(stdout_fd, ibuf, ZLOGIN_BUFSIZ)) > 0)
 			(void) write(STDOUT_FILENO, ibuf, cc);
 	}
 	if (pollfds[1].revents &
 	    (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
-		if ((cc = read(stderr_fd, ibuf, BUFSIZ)) > 0)
+		if ((cc = read(stderr_fd, ibuf, ZLOGIN_BUFSIZ)) > 0)
 			(void) write(STDERR_FILENO, ibuf, cc);
 	}
 }