conmon: Close client on zero read from attach client

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
Mrunal Patel 2017-06-06 19:42:27 -07:00
parent 0b6f68479b
commit 6e53568d15

View file

@ -1002,7 +1002,13 @@ int main(int argc, char *argv[])
}
} else {
num_read = read(masterfd, buf, BUF_SIZE);
if (num_read <= 0)
if (num_read == 0) {
ninfo("Remote socket closed");
close(conn_sock);
conn_sock = -1;
continue;
}
if (num_read < 0)
goto out;
ninfo("got data on connection: %d", num_read);
if (terminal) {