chiark / gitweb /
kmod-setup: use libkmod rather than modprobe
[elogind.git] / src / modules-load.c
index d76defa515732896d61f2d11a9ce1e7b6b432860..7384f25ab040487e6aff3b37e05d11aaac226728 100644 (file)
@@ -42,10 +42,12 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
+        log_set_target(LOG_TARGET_AUTO);
         log_parse_environment();
         log_open();
 
+        umask(0022);
+
         if (!(arguments = strv_new("/sbin/modprobe", "-sab", "--", NULL))) {
                 log_error("Failed to allocate string array");
                 goto finish;
@@ -75,7 +77,6 @@ int main(int argc, char *argv[]) {
                                 continue;
 
                         log_error("Failed to open %s: %m", *fn);
-                        free(fn);
                         r = EXIT_FAILURE;
                         continue;
                 }
@@ -129,6 +130,7 @@ finish:
 
         if (n_arguments > 3) {
                 arguments[n_arguments] = NULL;
+                strv_uniq(arguments);
                 execv("/sbin/modprobe", arguments);
 
                 log_error("Failed to execute /sbin/modprobe: %m");