From 336a72eb946ce9427c0ae28fdc25a51ae829f728 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 10 Feb 2021 14:04:09 -0500 Subject: [PATCH] lttng-ctl: health: remove unreachable condition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity reports: 1442789 Logically dead code The indicated dead code may have performed some action; that action will never occur. In lttng_health_create_relayd: Code can never be reached because of a logical contradiction (CWE-561) `path` is already checked for NULL before reaching the lttng_strncpy call. Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: Ifce95c37a6fe7f914a3bbc5443171c511d3c211a --- src/lib/lttng-ctl/lttng-ctl-health.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.c index dc1516db5..3de74fd11 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.c +++ b/src/lib/lttng-ctl/lttng-ctl-health.c @@ -231,8 +231,8 @@ struct lttng_health *lttng_health_create_relayd(const char *path) goto error; } - ret = lttng_strncpy(lh->health_sock_path, path ?: "", - sizeof(lh->health_sock_path)); + ret = lttng_strncpy(lh->health_sock_path, path, + sizeof(lh->health_sock_path)); if (ret) { goto error; } -- 2.34.1