From: Jérémie Galarneau Date: Tue, 6 Mar 2018 22:07:46 +0000 (-0500) Subject: Fix: create_output_path() relayd util is not const-correct X-Git-Tag: v2.10.4~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2cc6b436600827e0dcf1b889e9ff53be60491d8e;p=lttng-tools.git Fix: create_output_path() relayd util is not const-correct 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 --- 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 */