Fix: report error using fd instead of ret
[lttng-tools.git] / src / common / utils.c
index 30a5f106ba8b19ec6ebbf26a059ff20fd278062c..aa11551c30635fd4e423382092fd1871a2534b17 100644 (file)
@@ -190,7 +190,9 @@ error:
        free(resolved_path);
        free(cut_path);
        free(try_path);
-       free(try_path_prev);
+       if (try_path_prev != try_path) {
+               free(try_path_prev);
+       }
        return NULL;
 }
 
@@ -526,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;
        }
 
@@ -852,6 +854,7 @@ int utils_rotate_stream_file(char *path_name, char *file_name, uint64_t size,
                PERROR("Closing tracefile");
                goto error;
        }
+       *stream_fd = -1;
 
        if (count > 0) {
                /*
@@ -1372,11 +1375,11 @@ int utils_show_man_page(int section, const char *page_name)
        /*
         * Execute man pager.
         *
-        * We provide --manpath to man here because LTTng-tools can
+        * We provide -M to man here because LTTng-tools can
         * 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", "--manpath", MANPATH,
+       ret = execlp(man_bin_path, "man", "-M", MANPATH,
                section_string, page_name, NULL);
        return ret;
 }
This page took 0.024859 seconds and 4 git commands to generate.