Also check that we wrote the amount we expected to. The write on the pty is blocking but we could still get a short write on EINTR, so we should SYSERROR it.
Signed-off-by: Dwight Engen <dwight.en...@oracle.com> --- src/lxc/lxc_console.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c index 3dd2155..643c442 100644 --- a/src/lxc/lxc_console.c +++ b/src/lxc/lxc_console.c @@ -165,14 +165,18 @@ static int master_handler(int fd, void *data, struct lxc_epoll_descr *descr) { char buf[1024]; int *peer = (int *)data; - int r; + int r,w; r = read(fd, buf, sizeof(buf)); if (r < 0) { SYSERROR("failed to read"); return 1; } - r = write(*peer, buf, r); + w = write(*peer, buf, r); + if (w < 0 || w != r) { + SYSERROR("failed to write"); + return 1; + } return 0; } -- 1.7.12.3 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel