Mercurial > illumos > illumos-gate
changeset 2852:3395d6ba9de2 onnv_50
6263984 zlogin's i/o loop can sometimes drop data on child death
author | dp |
---|---|
date | Mon, 02 Oct 2006 16:12:28 -0700 |
parents | aaf35d5f6e35 |
children | 7064ad681ecc |
files | usr/src/cmd/zlogin/zlogin.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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); } }