If a signal comes in after ctx has been destroyed, it will try to use a
closed file descriptor.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- lttng_consumer_should_exit(ctx);
+ if (ctx) {
+ lttng_consumer_should_exit(ctx);
+ }
{
int ret = 0;
void *status;
{
int ret = 0;
void *status;
+ struct lttng_consumer_local_data *tmp_ctx;
/* Parse arguments */
progname = argv[0];
/* Parse arguments */
progname = argv[0];
- lttng_consumer_destroy(ctx);
+ tmp_ctx = ctx;
+ ctx = NULL;
+ cmm_barrier(); /* Clear ctx for signal handler. */
+ lttng_consumer_destroy(tmp_ctx);
lttng_consumer_cleanup();
if (health_consumerd) {
health_app_destroy(health_consumerd);
lttng_consumer_cleanup();
if (health_consumerd) {
health_app_destroy(health_consumerd);