X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmodules-load.c;h=7384f25ab040487e6aff3b37e05d11aaac226728;hb=6ef25fb65ee0a62972ed7cbc01b6a11feb5fcb16;hp=fac4511816011f7e6e65d089c223c5b07cbeeac4;hpb=db1413d7380acacc4e50faf801ca0d401da89764;p=elogind.git diff --git a/src/modules-load.c b/src/modules-load.c index fac451181..7384f25ab 100644 --- a/src/modules-load.c +++ b/src/modules-load.c @@ -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; @@ -53,13 +55,14 @@ int main(int argc, char *argv[]) { n_arguments = n_allocated = 3; - files = conf_files_list(".conf", - "/run/modules-load.d", - "/etc/modules-load.d", - "/usr/lib/modules-load.d", - NULL); - if (files == NULL) { - log_error("Failed to enumerate modules-load.d files: %m"); + if (conf_files_list(&files, ".conf", + "/run/modules-load.d", + "/etc/modules-load.d", + "/usr/local/lib/modules-load.d", + "/usr/lib/modules-load.d", + "/lib/modules-load.d", + NULL) < 0) { + log_error("Failed to enumerate modules-load.d files: %s", strerror(-r)); goto finish; } @@ -74,7 +77,6 @@ int main(int argc, char *argv[]) { continue; log_error("Failed to open %s: %m", *fn); - free(fn); r = EXIT_FAILURE; continue; } @@ -128,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");