From 2cc6b436600827e0dcf1b889e9ff53be60491d8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 6 Mar 2018 17:07:46 -0500 Subject: [PATCH] Fix: create_output_path() relayd util is not const-correct MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code using this utility assumes that the path name passed to this function is not modified. Using 'const' enforces this assumption. Moreover, this change makes it easier to write const-correct code in the relayd. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-relayd/utils.c | 6 +++--- src/bin/lttng-relayd/utils.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-relayd/utils.c b/src/bin/lttng-relayd/utils.c index 51fe19348..837c828d2 100644 --- a/src/bin/lttng-relayd/utils.c +++ b/src/bin/lttng-relayd/utils.c @@ -29,7 +29,7 @@ #include "lttng-relayd.h" #include "utils.h" -static char *create_output_path_auto(char *path_name) +static char *create_output_path_auto(const char *path_name) { int ret; char *traces_path = NULL; @@ -58,7 +58,7 @@ exit: return traces_path; } -static char *create_output_path_noauto(char *path_name) +static char *create_output_path_noauto(const char *path_name) { int ret; char *traces_path = NULL; @@ -84,7 +84,7 @@ exit: * * Return the allocated string containing the path name or else NULL. */ -char *create_output_path(char *path_name) +char *create_output_path(const char *path_name) { assert(path_name); diff --git a/src/bin/lttng-relayd/utils.h b/src/bin/lttng-relayd/utils.h index 4a56980e4..f0b618420 100644 --- a/src/bin/lttng-relayd/utils.h +++ b/src/bin/lttng-relayd/utils.h @@ -20,6 +20,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -char *create_output_path(char *path_name); +char *create_output_path(const char *path_name); #endif /* RELAYD_UTILS_H */ -- 2.34.1