Skip to content

Commit

Permalink
OS-6521 zoneadmd loses stdio.log messages when init process does 0-by…
Browse files Browse the repository at this point in the history
…te write to stdout/stderr

Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
jjelinek committed Dec 19, 2017
1 parent b036e0f commit 544f345
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions usr/src/cmd/zoneadmd/zfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2016 Joyent, Inc. All rights reserved.
* Copyright 2017 Joyent, Inc.
*/

/*
Expand Down Expand Up @@ -934,7 +934,8 @@ do_zfd_io(int gzctlfd, int gzservfd, int gzerrfd, int stdinfd, int stdoutfd,
(POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
errno = 0;
cc = read(stdoutfd, ibuf, BUFSIZ);
if (cc <= 0 && (errno != EINTR) &&
/* zfd is a stream, so ignore 0 length read */
if (cc < 0 && (errno != EINTR) &&
(errno != EAGAIN))
break;
if (cc > 0) {
Expand Down Expand Up @@ -962,7 +963,8 @@ do_zfd_io(int gzctlfd, int gzservfd, int gzerrfd, int stdinfd, int stdoutfd,
(POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) {
errno = 0;
cc = read(stderrfd, ibuf, BUFSIZ);
if (cc <= 0 && (errno != EINTR) &&
/* zfd is a stream, so ignore 0 length read */
if (cc < 0 && (errno != EINTR) &&
(errno != EAGAIN))
break;
if (cc > 0) {
Expand Down

0 comments on commit 544f345

Please sign in to comment.