Fix: lttng_rotate_session does not handle socket close
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Apr 2019 03:38:43 +0000 (23:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Apr 2019 03:40:54 +0000 (23:40 -0400)
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 <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/rotate.c

index d9871dc9d3e9f6c651126f917d765321adc116f2..446b332e41354599a18b2967f85a33456b9b0faf 100644 (file)
@@ -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;
        }
This page took 0.026438 seconds and 4 git commands to generate.