X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Futils.c;h=0eb7ab4fe410e561909e0fb0372fb8b5b5bfa96e;hb=a188e2a6df728ca53e660603c91a60ea89364c40;hp=4d49728c0f47a23cce6eba1bc2f72f11c2c14836;hpb=db5be0a3dcf30edeca9c3143682454bab9523f71;p=lttng-tools.git diff --git a/src/common/utils.c b/src/common/utils.c index 4d49728c0..0eb7ab4fe 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -528,7 +528,7 @@ int utils_create_lock_file(const char *filepath) S_IRGRP | S_IWGRP); if (fd < 0) { PERROR("open lock file %s", filepath); - ret = -1; + fd = -1; goto error; } @@ -1429,11 +1429,17 @@ static const char *get_man_bin_path(void) } LTTNG_HIDDEN -int utils_show_man_page(int section, const char *page_name) +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(); - int ret; + int ret = 0; + + if (help_msg) { + printf("%s", help_msg); + goto end; + } /* Section integer -> section string */ ret = sprintf(section_string, "%d", section); @@ -1448,5 +1454,7 @@ int utils_show_man_page(int section, const char *page_name) */ ret = execlp(man_bin_path, "man", "-M", MANPATH, section_string, page_name, NULL); + +end: return ret; }