Fix: consumerd/relayd health paths
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 9 Oct 2013 18:00:13 +0000 (14:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 9 Oct 2013 18:00:13 +0000 (14:00 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-consumerd/health-consumerd.c
src/bin/lttng-relayd/health-relayd.c

index 60808f37094d304480468875c5cde6b944599c9c..413df9acfb92eff3ad4e3566708c7709edd6fe24 100644 (file)
@@ -119,8 +119,6 @@ int setup_health_path(void)
                        goto end;
                }
        } else {
-               static char *rundir;
-
                home_path = utils_get_home_dir();
                if (home_path == NULL) {
                        /* TODO: Add --socket PATH option */
@@ -129,16 +127,6 @@ int setup_health_path(void)
                        goto end;
                }
 
-               /*
-                * Create rundir from home path. This will create something like
-                * $HOME/.lttng
-                */
-               ret = asprintf(&rundir, DEFAULT_LTTNG_HOME_RUNDIR, home_path);
-               if (ret < 0) {
-                       ret = -ENOMEM;
-                       goto end;
-               }
-
                /* Set health check Unix path */
                if (strlen(health_unix_sock_path) != 0) {
                        goto end;
@@ -146,22 +134,21 @@ int setup_health_path(void)
                switch (type) {
                case LTTNG_CONSUMER_KERNEL:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK, home_path);
                        break;
                case LTTNG_CONSUMER64_UST:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK, home_path);
                        break;
                case LTTNG_CONSUMER32_UST:
                        snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK, rundir);
+                               DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK, home_path);
                        break;
                default:
                        ret = -EINVAL;
                        goto end;
                }
        }
-
 end:
        return ret;
 }
index f2b167c4a0375e58a740d0369551e153854542e8..61e50367cb0eb1bfeadeb1e549468d180145afa0 100644 (file)
@@ -133,7 +133,7 @@ static
 int setup_health_path(void)
 {
        int is_root, ret = 0;
-       char *home_path = NULL, *rundir, *relayd_path;
+       char *home_path = NULL, *rundir = NULL, *relayd_path;
 
        is_root = !getuid();
 
@@ -195,6 +195,7 @@ int setup_health_path(void)
        }
 
 end:
+       free(rundir);
        return ret;
 }
 
This page took 0.02693 seconds and 4 git commands to generate.