From: Mathieu Desnoyers Date: Fri, 18 Sep 2015 18:46:23 +0000 (-0400) Subject: Fix: shm-path: handling of snprintf return value X-Git-Tag: v2.7.0-rc2~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=51a9615b7598293b22451ad55eb8daa8d3e3408a;p=lttng-tools.git Fix: shm-path: handling of snprintf return value Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index d45707b76..08e6ee0d8 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -254,8 +254,8 @@ 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) { - ret = -1; + if (ret < 0) { + PERROR("snprintf"); goto end; } strncat(stream_shm_path, cpu_nr,