aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-11-16 07:15:00 -0500
committerMike Frysinger <vapier@gentoo.org>2010-11-16 07:15:00 -0500
commit8ce1ad3097ca6b92293ca767f6e4ddd98ad0d90e (patch)
treefc89a095caf49d166a9f80da738beb966c1e947e
parent2e9aeae4dbc7bd45640ac472ee6ecb7eaf89fe8d (diff)
downloadbusybox-w32-8ce1ad3097ca6b92293ca767f6e4ddd98ad0d90e.tar.gz
busybox-w32-8ce1ad3097ca6b92293ca767f6e4ddd98ad0d90e.tar.bz2
busybox-w32-8ce1ad3097ca6b92293ca767f6e4ddd98ad0d90e.zip
depmod.pl: add recursive sanity check
If modules contain circular dependencies, the depmod script will follow the circle forever. So add a simple sanity check to abort rather than chew up the CPU. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-xexamples/depmod.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/depmod.pl b/examples/depmod.pl
index 8c6548d28..f324b121a 100755
--- a/examples/depmod.pl
+++ b/examples/depmod.pl
@@ -173,6 +173,9 @@ sub add_mod_deps
173 173
174 $depth .= " "; 174 $depth .= " ";
175 warn "${depth}loading deps of module: $this_module\n" if $verbose; 175 warn "${depth}loading deps of module: $this_module\n" if $verbose;
176 if (length($depth) > 50) {
177 die "too much recursion (circular dependencies in modules?)";
178 }
176 179
177 foreach my $md (keys %{$mod->{$this_module}}) { 180 foreach my $md (keys %{$mod->{$this_module}}) {
178 add_mod_deps ($depth, $mod, $mod2, $module, $md); 181 add_mod_deps ($depth, $mod, $mod2, $module, $md);