mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 01:26:38 +00:00
probe-utils.pm: refactor switch statement
switch() is only available if explicitly declared. switch to a for block using elsif to return a value.
This commit is contained in:
parent
761eb497ca
commit
f89f611ca9
@ -252,17 +252,20 @@ sub is_selinux_enable {
|
||||
|
||||
#------------------------------------------
|
||||
sub is_selinux_enforcing {
|
||||
my $retval = 0;
|
||||
if (-e "/usr/sbin/getenforce") {
|
||||
my $enforce_mode = `/usr/sbin/getenforce`;
|
||||
chomp $enforce_mode;
|
||||
switch ($enforce_mode) {
|
||||
case "Disabled" { return 0; }
|
||||
case "Permissive" { return 0; }
|
||||
case "Enforcing" { return 1; }
|
||||
else { return 0; }
|
||||
for ($enforce_mode) {
|
||||
if (/Disabled/) { $retval = 0; }
|
||||
elsif (/Permissive/) { $retval = 0; }
|
||||
elsif (/Enforcing/) { $retval = 1; }
|
||||
else { $retval = 0; }
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
$retval = 0;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
#------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user