mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
plugins: modprobe: Never follow symlinks in /sys/devices
Unlike find(1), nftw(3) defaults to follow symlinks. For some kernel configurations this turned out to be detrimental and caused the plugin to loop forever scanning modalias files. Also, check if /sys is mounted before even calling nftw(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+11
-4
@@ -142,11 +142,18 @@ static void coldplug(void *arg)
|
||||
struct module *m, *tmp;
|
||||
int rc = 0;
|
||||
|
||||
if (!fismnt("/sys")) {
|
||||
print(1, "Cannot modprobe system, /sys is not mounted");
|
||||
return;
|
||||
}
|
||||
|
||||
print_desc("Cold plugging system", NULL);
|
||||
nftw("/sys/devices", scan_alias, 200, FTW_DEPTH);
|
||||
TAILQ_FOREACH_SAFE(m, &modules, link, tmp) {
|
||||
rc += modprobe(m->alias);
|
||||
alias_remove(m);
|
||||
rc = nftw("/sys/devices", scan_alias, 200, FTW_DEPTH | FTW_PHYS);
|
||||
if (!rc) {
|
||||
TAILQ_FOREACH_SAFE(m, &modules, link, tmp) {
|
||||
rc += modprobe(m->alias);
|
||||
alias_remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
print_result(rc);
|
||||
|
||||
Reference in New Issue
Block a user