#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <assert.h>
#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000 /* usec */
static volatile int quit = 0;
-static void sighandler(int signal)
+static void sighandler(int signal __attribute__((unused)))
{
- printf("Signal caught, exiting\n");
+ const char msg[] = "Signal caught, exiting\n";
+ const int ret = write(STDOUT_FILENO, msg, sizeof(msg));
+
+ assert(ret == 0); /* NOLINT assert is not async signal safe */
quit = 1;
}
int ret;
struct lttng_domain dom;
struct lttng_event ev;
- struct lttng_handle *chan_handle;
+ struct lttng_handle *chan_handle = NULL;
printf("Creating session %s\n", session_name);
ret = lttng_create_session(session_name, path);
goto end;
}
- lttng_destroy_handle(chan_handle);
-
ret = 0;
end:
+ lttng_destroy_handle(chan_handle);
return ret;
}