[lttng-dev] [PATCH lttng-tools] Fix: shm-path: handling of snprintf return value

Jérémie Galarneau jeremie.galarneau at efficios.com
Mon Sep 21 11:31:35 EDT 2015


Merged in master and stable-2.7.

Thanks!
Jérémie

On Fri, Sep 18, 2015 at 2:46 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
>  src/common/ust-consumer/ust-consumer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
> index d45707b..a342f97 100644
> --- a/src/common/ust-consumer/ust-consumer.c
> +++ b/src/common/ust-consumer/ust-consumer.c
> @@ -254,7 +254,7 @@ int get_stream_shm_path(char *stream_shm_path, const char *shm_path, int cpu)
>         strncpy(stream_shm_path, shm_path, PATH_MAX);
>         stream_shm_path[PATH_MAX - 1] = '\0';
>         ret = snprintf(cpu_nr, UINT_MAX_STR_LEN, "%u", cpu);
> -       if (ret != 1) {
> +       if (ret < 0) {
>                 ret = -1;
>                 goto end;
>         }
> --
> 2.1.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list