Allow release object to have -1 sock param
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 14 Nov 2011 04:08:06 +0000 (23:08 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 14 Nov 2011 04:08:06 +0000 (23:08 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-ctl/ustctl.c

index f9c5e84fab59ef65116b70aa7d8df1941a123027..ed814b29e9883059a15c39c4c4ac5899b75aaf5f 100644 (file)
@@ -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);
 }
 
This page took 0.026692 seconds and 4 git commands to generate.