* Alexandre Montplaisir ([email protected]) wrote:
> The handling of the "consumerd32_path" and "consumerd64_path" was
> lacking consistency ; in some cases it would include the filename
> "lttng-consumerd" at the end, in some others it would not.
> 
> What is proposed here is to consider the configure options and
> environment variables as real "paths", so the user would never have
> to specify filenames ("lttng-consumerd" is assumed). However in
> the program itself we'll append the filename, so we can easily
> test for its existence and run exec(consumer_path, ...)
> 
> Signed-off-by: Alexandre Montplaisir <[email protected]>
> ---
>  lttng-sessiond/main.c |   32 ++++++++++++++++++++++++++------
>  1 files changed, 26 insertions(+), 6 deletions(-)
> 
> diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c
> index fcae023..77f86ae 100644
> --- a/lttng-sessiond/main.c
> +++ b/lttng-sessiond/main.c
> @@ -184,6 +184,7 @@ static
>  void setup_consumerd_path(void)
>  {
>       const char *path, *libdir;
> +     int ret;
>  
>       /*
>        * Allow INSTALL_BIN_PATH to be used as a target path for the
> @@ -213,20 +214,39 @@ void setup_consumerd_path(void)
>        */
>       path = getenv("LTTNG_CONSUMERD32_PATH");
>       if (path) {
> -             consumerd32_path = path;
> +             ret = asprintf((char**)&consumerd32_path, "%s/" CONSUMERD_FILE, 
> path);

This cast tells me something is wrong. I'll let David reply.

Thanks,

Mathieu

> +             if (ret < 0) {
> +                     PERROR("asprintf consumerd32_path");
> +                     goto error;
> +             }
>       }
>       path = getenv("LTTNG_CONSUMERD64_PATH");
>       if (path) {
> -             consumerd64_path = path;
> +             ret = asprintf((char**)&consumerd64_path, "%s/" CONSUMERD_FILE, 
> path);
> +             if (ret < 0) {
> +                     PERROR("asprintf consumerd64_path");
> +                     goto error;
> +             }
>       }
> -     libdir = getenv("LTTNG_TOOLS_CONSUMERD32_LIBDIR");
> +     libdir = getenv("LTTNG_CONSUMERD32_LIBDIR");
>       if (libdir) {
> -             consumerd32_libdir = libdir;
> +             consumerd32_libdir = strdup(libdir);
> +             if (consumerd32_libdir == NULL) {
> +                     PERROR("strdup consumerd32_libdir");
> +                     goto error;
> +             }
>       }
> -     libdir = getenv("LTTNG_TOOLS_CONSUMERD64_LIBDIR");
> +     libdir = getenv("LTTNG_CONSUMERD64_LIBDIR");
>       if (libdir) {
> -             consumerd64_libdir = libdir;
> +             consumerd64_libdir = strdup(libdir);
> +             if (consumerd64_libdir == NULL) {
> +                     PERROR("strdup consumerd64_libdir");
> +                     goto error;
> +             }
>       }
> +
> +error:
> +     return;
>  }
>  
>  /*
> -- 
> 1.7.7.3
> 
> 
> _______________________________________________
> lttng-dev mailing list
> [email protected]
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to