From: Mathieu Desnoyers Date: Mon, 14 Nov 2011 04:08:06 +0000 (-0500) Subject: Allow release object to have -1 sock param X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=123881664dc99ef7817e8a3e7ca59d5eaa976d06;p=lttng-ust.git Allow release object to have -1 sock param Signed-off-by: Mathieu Desnoyers --- 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); }