From 5de4abb8ee322352c9b9fafad9068a0f74c51470 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 15 Apr 2011 13:52:00 +0000 Subject: - do not harcode module name, use a better regexp and shorter line to check if the module is already loaded --- iurt_root_command | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'iurt_root_command') diff --git a/iurt_root_command b/iurt_root_command index 9db3404..8a27a39 100755 --- a/iurt_root_command +++ b/iurt_root_command @@ -203,12 +203,9 @@ sub modprobe { plog("ERROR: unauthorized module $module"); return 0; } - open my $modules, '/proc/modules'; - while (my $m = <$modules>) { - if ($m =~ /unionfs/) { - return 1; - } - } + + return 1 if grep { /^$module\b/ } read_file("/proc/modules"); + system("/sbin/depmod", "-a"); !system("/sbin/modprobe", "-f", $module); } -- cgit v1.2.1