Fix: initialize syscall table when kernel tracer is lazily initialized
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 125a18769107269322813923d438e51f062694ae..936a8df9dc70d4dfd810c08a9296e6c2ca256d64 100644 (file)
@@ -2765,6 +2765,12 @@ static int init_kernel_tracer(void)
        }
 
        DBG("Kernel tracer fd %d", kernel_tracer_fd);
+
+       ret = syscall_init_table();
+       if (ret < 0) {
+               ERR("Unable to populate syscall table. Syscall tracing won't "
+                       "work for this session daemon.");
+       }
        return 0;
 
 error_version:
@@ -4978,10 +4984,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                                "-l, --load");
                } else {
                        free(opt_load_session_path);
-                       opt_load_session_path = strdup(arg);
+                       opt_load_session_path = utils_expand_path(arg);
                        if (!opt_load_session_path) {
-                               PERROR("strdup");
-                               ret = -ENOMEM;
+                               ERR("Failed to expand load path %s", arg);
+                               ret = -EINVAL;
                        }
                }
        } else if (string_match(optname, "kmod-probes")) {
@@ -5980,14 +5986,6 @@ int main(int argc, char **argv)
                /* Setup kernel tracer */
                if (!opt_no_kernel) {
                        init_kernel_tracer();
-                       if (kernel_tracer_fd >= 0) {
-                               ret = syscall_init_table();
-                               if (ret < 0) {
-                                       ERR("Unable to populate syscall table. "
-                                               "Syscall tracing won't work "
-                                               "for this session daemon.");
-                               }
-                       }
                }
 
                /* Set ulimit for open files */
This page took 0.025244 seconds and 4 git commands to generate.