From 67f8cb8d6212bc14f5c4a35f34e01c4f631c0d6e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 18 Sep 2015 14:46:23 -0400 Subject: [PATCH] Fix: shm-path: handling of snprintf return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/common/ust-consumer/ust-consumer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, -- 2.34.1