diff options
author | Mike Gerdts <mike.gerdts@joyent.com> | 2019-05-01 22:08:07 +0000 |
---|---|---|
committer | Mike Gerdts <mike.gerdts@joyent.com> | 2019-05-02 19:39:06 +0000 |
commit | 38ab7e0ec12be74cc501e210e468de0c3e49c45f (patch) | |
tree | a220f1826ccb4b2adbc4cedc179fe6c4fbafb24c | |
parent | 45d2f6a617bfe6c46ea2f779e3898b5518163af7 (diff) | |
download | illumos-joyent-38ab7e0ec12be74cc501e210e468de0c3e49c45f.tar.gz |
OS-7779 zoneadmd calls logstream_write with negative message length
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r-- | usr/src/cmd/zoneadmd/zcons.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/usr/src/cmd/zoneadmd/zcons.c b/usr/src/cmd/zoneadmd/zcons.c index 70abfc8d66..5f415b0210 100644 --- a/usr/src/cmd/zoneadmd/zcons.c +++ b/usr/src/cmd/zoneadmd/zcons.c @@ -782,17 +782,21 @@ do_console_io(zlog_t *zlogp, int consfd, int servfd, int conslog) (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) { errno = 0; cc = read(consfd, ibuf, BUFSIZ); - if (cc <= 0 && (errno != EINTR) && - (errno != EAGAIN)) - break; - - logstream_write(conslog, ibuf, cc); - - /* - * Lose I/O if no one is listening - */ - if (clifd != -1 && cc > 0) - (void) write(clifd, ibuf, cc); + if (cc <= 0) { + if (errno != EINTR && + errno != EAGAIN) { + break; + } + } else { + logstream_write(conslog, ibuf, cc); + + /* + * Lose I/O if no one is listening + */ + if (clifd != -1) { + (void) write(clifd, ibuf, cc); + } + } } else { pollerr = pollfds[0].revents; zerror(zlogp, B_FALSE, |