From 123881664dc99ef7817e8a3e7ca59d5eaa976d06 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 13 Nov 2011 23:08:06 -0500 Subject: [PATCH] Allow release object to have -1 sock param Signed-off-by: Mathieu Desnoyers --- liblttng-ust-ctl/ustctl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index f9c5e84f..ed814b29 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -39,6 +39,10 @@ void init_object(struct lttng_ust_object_data *data) data->memory_map_size = 0; } +/* + * If sock is negative, it means we don't have to notify the other side + * (e.g. application has already vanished). + */ void ustctl_release_object(int sock, struct lttng_ust_object_data *data) { struct ustcomm_ust_msg lum; @@ -49,11 +53,13 @@ void ustctl_release_object(int sock, struct lttng_ust_object_data *data) close(data->shm_fd); if (data->wait_fd >= 0) close(data->wait_fd); - memset(&lum, 0, sizeof(lum)); - lum.handle = data->handle; - lum.cmd = LTTNG_UST_RELEASE; - ret = ustcomm_send_app_cmd(sock, &lum, &lur); - assert(!ret); + if (sock >= 0) { + memset(&lum, 0, sizeof(lum)); + lum.handle = data->handle; + lum.cmd = LTTNG_UST_RELEASE; + ret = ustcomm_send_app_cmd(sock, &lum, &lur); + assert(!ret); + } free(data); } -- 2.34.1