X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmodules-load.c;h=3824b57de7649293e65793b5e0123a0bdade05d7;hp=56f2a907f4cc2a68a7450078c24b4faacd688052;hb=d24e1b4806e7e96b0c5bc0950ce79e8f76c2ab71;hpb=fd5bf055acae23a5ff0fcce8425675703f7bf5e0 diff --git a/src/modules-load.c b/src/modules-load.c index 56f2a907f..3824b57de 100644 --- a/src/modules-load.c +++ b/src/modules-load.c @@ -31,7 +31,7 @@ #include "util.h" #include "strv.h" -/* This reads all module names listed in /etc/modules.d/?*.conf and +/* This reads all module names listed in /etc/modules-load.d/?*.conf and * loads them into the kernel. This follows roughly Debian's way to * handle modules, but uses a directory of fragments instead of a * single /etc/modules file. */ @@ -43,7 +43,8 @@ static int scandir_filter(const struct dirent *d) { return 0; if (d->d_type != DT_REG && - d->d_type != DT_LNK) + d->d_type != DT_LNK && + d->d_type != DT_UNKNOWN) return 0; return endswith(d->d_name, ".conf"); @@ -71,12 +72,12 @@ int main(int argc, char *argv[]) { n_arguments = n_allocated = 3; - if ((n = scandir("/etc/modules.d/", &de, scandir_filter, alphasort)) < 0) { + if ((n = scandir("/etc/modules-load.d/", &de, scandir_filter, alphasort)) < 0) { if (errno == ENOENT) r = EXIT_SUCCESS; else - log_error("Failed to enumerate /etc/modules.d/ files: %m"); + log_error("Failed to enumerate /etc/modules-load.d/ files: %m"); goto finish; } @@ -88,7 +89,7 @@ int main(int argc, char *argv[]) { char *fn; FILE *f; - k = asprintf(&fn, "/etc/modules.d/%s", de[i]->d_name); + k = asprintf(&fn, "/etc/modules-load.d/%s", de[i]->d_name); free(de[i]); if (k < 0) { @@ -98,14 +99,21 @@ int main(int argc, char *argv[]) { } f = fopen(fn, "re"); - free(fn); if (!f) { + if (errno == ENOENT) { + free(fn); + continue; + } + log_error("Failed to open %s: %m", fn); + free(fn); r = EXIT_FAILURE; continue; } + free(fn); + for (;;) { char line[LINE_MAX], *l, *t;