From 3b1ddb0b6e3ca2273ef45fbd1b4ad24a0ed14685 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Sun, 2 Dec 2012 22:07:52 -0500 Subject: [PATCH] Cygwin: Fixup of wait pipe hangup commit The condition in lttng_ustconsumer_check_pipe was wrong. Signed-off-by: Christian Babeux --- src/common/ust-consumer/ust-consumer.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 9d624966b..31e0d4ba7 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -424,17 +424,19 @@ int lttng_ustconsumer_check_pipe(struct lttng_consumer_stream *stream, stream->wait_fd, stream->key); /* We consume the 1 byte written into the wait_fd by UST */ - if (!stream->hangup_flush_done) { - do { - readlen = read(stream->wait_fd, &dummy, 1); - } while (readlen == -1 && errno == EINTR); - if (readlen == -1) { - return -1; /* error */ - } - DBG("Read %zu byte from pipe: %c\n", readlen, dummy); - if (readlen == 0) - return 1; /* POLLHUP */ + + do { + readlen = read(stream->wait_fd, &dummy, 1); + } while (readlen == -1 && errno == EINTR); + if (readlen == -1) { + return -1; /* error */ } + + DBG("Read %zu byte from pipe: %c\n", readlen, readlen ? dummy : '\0'); + + if (readlen == 0) + return 1; /* POLLHUP */ + return 0; /* no error nor HUP */ } -- 2.34.1