From 1320cab14db79aad4429e9f207ba8fa27b52f498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 9 Apr 2019 23:38:43 -0400 Subject: [PATCH] Fix: lttng_rotate_session does not handle socket close MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit lttng_ctl_ask_sessiond may return 0 if the sessiond process is killed or if its client socket is closed unexpectedly. This causes lttng_rotate_session to assume a rotation command reply has been received, resulting in a NULL pointer dereference later on. Signed-off-by: Jérémie Galarneau --- src/lib/lttng-ctl/rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.c index d9871dc9d..446b332e4 100644 --- a/src/lib/lttng-ctl/rotate.c +++ b/src/lib/lttng-ctl/rotate.c @@ -233,7 +233,7 @@ int lttng_rotate_session(const char *session_name, sizeof(lsm.session.name)); ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return); - if (ret < 0) { + if (ret <= 0) { *rotation_handle = NULL; goto end; } -- 2.34.1