Changeset 32130

Show
Ignore:
Timestamp:
13.02.2018 11:18:58 (13 days ago)
Author:
kjdon
Message:

check whether an item in sites folder is actually a directory before trying to check it. checked_chdir outputs an error if it cant chdir into it. I had a zip file in my sites folder and it caused remote gli to stop working.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl

    r29730 r32130  
    914914    { 
    915915        my $site_dir_path= &util::filename_cat($sites_directory,$sites_dir); 
    916         $gsdl_cgi->checked_chdir($site_dir_path); 
    917         opendir(DIR,$site_dir_path); 
    918         @site_dir=readdir(DIR); 
    919         closedir(DIR); 
    920          
    921         foreach $sub_dir_file(@site_dir) 
    922         { 
    923         if ($sub_dir_file eq "siteConfig.xml"){ 
    924             print STDOUT "$sites_dir" . "-----"; 
     916        if (-d $site_dir_path) { 
     917        $gsdl_cgi->checked_chdir($site_dir_path); 
     918        opendir(DIR,$site_dir_path); 
     919        @site_dir=readdir(DIR); 
     920        closedir(DIR); 
     921         
     922        foreach $sub_dir_file(@site_dir) 
     923        { 
     924            if ($sub_dir_file eq "siteConfig.xml"){ 
     925            print STDOUT "$sites_dir" . "-----"; 
     926            last; 
     927            } 
    925928        } 
    926929        }