Back to smart wouthout debug
This commit is contained in:
58
smart.cmake
58
smart.cmake
@@ -115,63 +115,11 @@ if( ( $c[0] eq 'service' && $c[1] eq 'control' ) ||
|
|||||||
{
|
{
|
||||||
# Service control must run before drop_root().
|
# Service control must run before drop_root().
|
||||||
# /service/control is the preferred path; /cgi-bin/control is kept as a legacy alias.
|
# /service/control is the preferred path; /cgi-bin/control is kept as a legacy alias.
|
||||||
my @control_paths = ();
|
my $rv = do( $smart_control_path );
|
||||||
|
if( ! defined $rv )
|
||||||
if( defined( $smart_control_path ) && $smart_control_path ne '' &&
|
|
||||||
$smart_control_path !~ /^\@.*\@/ )
|
|
||||||
{
|
{
|
||||||
push( @control_paths, $smart_control_path );
|
error( 500 );
|
||||||
}
|
}
|
||||||
|
|
||||||
push( @control_paths, $smart_libexec_dir . '/control' );
|
|
||||||
|
|
||||||
my %seen_control_path = ();
|
|
||||||
my $control_loaded = 0;
|
|
||||||
my $control_error = '';
|
|
||||||
|
|
||||||
foreach my $control_path ( @control_paths )
|
|
||||||
{
|
|
||||||
next if $seen_control_path{$control_path}++;
|
|
||||||
next if $control_path eq '';
|
|
||||||
|
|
||||||
if( ! -r $control_path )
|
|
||||||
{
|
|
||||||
$control_error .= "Cannot read control helper: $control_path: $!\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $rv = do( $control_path );
|
|
||||||
if( defined( $rv ) )
|
|
||||||
{
|
|
||||||
$control_loaded = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $@ ne '' )
|
|
||||||
{
|
|
||||||
$control_error .= "Could not compile control helper $control_path: $@\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$control_error .= "Could not load control helper $control_path: $!\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! $control_loaded )
|
|
||||||
{
|
|
||||||
$control_error = 'Unknown control helper loading error.' if $control_error eq '';
|
|
||||||
print <<EOF;
|
|
||||||
HTTP/1.0 500 Internal server error
|
|
||||||
Content-Type: text/plain
|
|
||||||
$server_id
|
|
||||||
|
|
||||||
Could not load SMArT service control helper.
|
|
||||||
|
|
||||||
$control_error
|
|
||||||
EOF
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_request();
|
handle_request();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user