Fix handling of sessiond respawn after a SIGKILL
[lttng-tools.git] / liblttngctl / liblttngctl.c
index 4faf8414f7cf5d7deb31f2658ee0a7a850a1fe00..2464bce3b2d1eb30ab0252a2fc4f224a5a85b0c0 100644 (file)
@@ -608,13 +608,22 @@ int lttng_session_daemon_alive(void)
                return ret;
        }
 
-       /* If socket exist, we consider the daemon started */
+       /* If socket exist, we check if the daemon listens to connect. */
        ret = access(sessiond_sock_path, F_OK);
        if (ret < 0) {
                /* Not alive */
                return 0;
        }
 
+       ret = lttcomm_connect_unix_sock(sessiond_sock_path);
+       if (ret < 0) {
+               /* Not alive */
+               return 0;
+       }
+       ret = lttcomm_close_unix_sock(ret);
+       if (ret < 0)
+               perror("lttcomm_close_unix_sock");
+
        /* Is alive */
        return 1;
 }
This page took 0.022655 seconds and 4 git commands to generate.