X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Futils.cpp;h=7cd61c049c3ffeae0b7bdcf74dc5a0eb9a6c58da;hp=0f6e0362f2d32f6c557ffede0341ed0d829b2ff7;hb=ef4a570db1fbc6ffa5f645e76c4cf25e8098aee1;hpb=46d51dbdc8b9c93871c34416006cf7f28b987c90 diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 0f6e0362f..7cd61c049 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -1020,10 +1020,23 @@ static const char *get_man_bin_path() return DEFAULT_MAN_BIN_PATH; } +static const char *get_manpath() +{ + char *manpath = lttng_secure_getenv(DEFAULT_MANPATH); + + if (manpath) { + return manpath; + } + + /* As defined during configuration. */ + return MANPATH; +} + int utils_show_help(int section, const char *page_name, const char *help_msg) { char section_string[8]; const char *man_bin_path = get_man_bin_path(); + const char *manpath = get_manpath(); int ret = 0; if (help_msg) { @@ -1042,7 +1055,7 @@ int utils_show_help(int section, const char *page_name, const char *help_msg) * be installed outside /usr, in which case its man pages are * not located in the default /usr/share/man directory. */ - ret = execlp(man_bin_path, "man", "-M", MANPATH, section_string, page_name, NULL); + ret = execlp(man_bin_path, "man", "-M", manpath, section_string, page_name, NULL); end: return ret;