Fix: tests: fix unused-but-set warning in test_fd_tracker.c
[lttng-tools.git] / src / bin / lttng-sessiond / modprobe.c
index bc2a86d7512a3321f20c20b36f828aa36f1fc164..24b34d0942b320a8fb9b888a8fd9db0d43620592 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/wait.h>
@@ -514,14 +513,23 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules,
                modprobe[sizeof(modprobe) - 1] = '\0';
                ret = system(modprobe);
                if (ret == -1) {
-                       ERR("Unable to launch modprobe -r for module %s",
-                                       modules[i].name);
-               } else if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED && WEXITSTATUS(ret) != 0) {
-                       ERR("Unable to remove module %s",
-                                       modules[i].name);
+                       if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
+                               ERR("Unable to launch modprobe -r for required module %s",
+                                               modules[i].name);
+                       } else {
+                               DBG("Unable to launch modprobe -r for optional module %s",
+                                               modules[i].name);
+                       }
+               } else if (WEXITSTATUS(ret) != 0) {
+                       if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
+                               ERR("Unable to remove required module %s",
+                                               modules[i].name);
+                       } else {
+                               DBG("Unable to remove optional module %s",
+                                               modules[i].name);
+                       }
                } else {
-                       DBG("Modprobe removal successful %s",
-                                       modules[i].name);
+                       DBG("Modprobe removal successful %s", modules[i].name);
                }
        }
 }
@@ -635,7 +643,7 @@ static int append_list_to_probes(const char *list)
        int ret;
        char *tmp_list, *cur_list, *saveptr;
 
-       assert(list);
+       LTTNG_ASSERT(list);
 
        cur_list = tmp_list = strdup(list);
        if (!tmp_list) {
@@ -709,7 +717,7 @@ int modprobe_lttng_data(void)
         * Base probes: either from command line option, environment
         * variable or default list.
         */
-       list = config.kmod_probes_list.value;
+       list = the_config.kmod_probes_list.value;
        if (list) {
                /* User-specified probes. */
                ret = append_list_to_probes(list);
@@ -745,7 +753,7 @@ int modprobe_lttng_data(void)
        /*
         * Extra modules? Append them to current probes list.
         */
-       list = config.kmod_extra_probes_list.value;
+       list = the_config.kmod_extra_probes_list.value;
        if (list) {
                ret = append_list_to_probes(list);
                if (ret) {
This page took 0.023952 seconds and 4 git commands to generate.