chiark / gitweb /
modules-load: filter out double modules
[elogind.git] / src / modules-load.c
index d76defa515732896d61f2d11a9ce1e7b6b432860..17b5e0bf80d5b3213d39eeb6ea1941509098287d 100644 (file)
@@ -46,6 +46,8 @@ int main(int argc, char *argv[]) {
         log_parse_environment();
         log_open();
 
         log_parse_environment();
         log_open();
 
+        umask(0022);
+
         if (!(arguments = strv_new("/sbin/modprobe", "-sab", "--", NULL))) {
                 log_error("Failed to allocate string array");
                 goto finish;
         if (!(arguments = strv_new("/sbin/modprobe", "-sab", "--", NULL))) {
                 log_error("Failed to allocate string array");
                 goto finish;
@@ -129,6 +131,7 @@ finish:
 
         if (n_arguments > 3) {
                 arguments[n_arguments] = NULL;
 
         if (n_arguments > 3) {
                 arguments[n_arguments] = NULL;
+                strv_uniq(arguments);
                 execv("/sbin/modprobe", arguments);
 
                 log_error("Failed to execute /sbin/modprobe: %m");
                 execv("/sbin/modprobe", arguments);
 
                 log_error("Failed to execute /sbin/modprobe: %m");