X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=90c700129159129876fb1d54ac19bb9f566dde3b;hp=26ff56effe8f57715822badae8d8df2ade6c092e;hb=a6cd2b97ca69d302670109fef8340bd927270a30;hpb=3448e2667be7445ae7630a18c2ab32cb2bcdd174 diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 26ff56eff..90c700129 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -45,7 +45,11 @@ int consumer_recv_status_reply(struct consumer_socket *sock) assert(sock); ret = lttcomm_recv_unix_sock(sock->fd, &reply, sizeof(reply)); - if (ret < 0) { + if (ret <= 0) { + if (ret == 0) { + /* Orderly shutdown. Don't return 0 which means success. */ + ret = -1; + } /* The above call will print a PERROR on error. */ DBG("Fail to receive status reply on sock %d", sock->fd); goto end; @@ -810,7 +814,11 @@ int consumer_is_data_pending(unsigned int id, */ ret = lttcomm_recv_unix_sock(socket->fd, &ret_code, sizeof(ret_code)); - if (ret < 0) { + if (ret <= 0) { + if (ret == 0) { + /* Orderly shutdown. Don't return 0 which means success. */ + ret = -1; + } /* The above call will print a PERROR on error. */ DBG("Error on recv consumer is data pending on sock %d", socket->fd); pthread_mutex_unlock(socket->lock);