From: Jérémie Galarneau Date: Wed, 10 Apr 2019 03:38:43 +0000 (-0400) Subject: Fix: lttng_rotate_session does not handle socket close X-Git-Tag: v2.11.0-rc2~36 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6e8ac53d0c18d83200fac0b2c221ef39306094d3;p=lttng-tools.git Fix: lttng_rotate_session does not handle socket close 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 --- 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; }