complain if files are outside $base
authorIan Beckwith <ianb@erislabs.net>
Sat, 2 Oct 2010 00:43:08 +0000 (01:43 +0100)
committerIan Beckwith <ianb@erislabs.net>
Sat, 2 Oct 2010 00:43:08 +0000 (01:43 +0100)
bin/id3fs-index
lib/ID3FS/DB.pm

index 132d81e..93a6ebf 100755 (executable)
@@ -48,12 +48,17 @@ if($list)
 else
 {
     $db->last_update(time());
-
-    my $directories_pruned=$db->prune_directories();
+    my $base=$db->base_dir();
+    my $abs_base=Cwd::abs_path($base);
     while(my $path=shift)
     {
+       if(Cwd::abs_path($path) !~ /^$abs_base/)
+       {
+           print "$me, $path is outside $base, skipping\n";
+       }
        File::Find::find( {wanted => \&wanted, follow => 1, no_chdir => 1}, $path);
     }
+    my $directories_pruned=$db->prune_directories();
     if($files_pruned || $directories_pruned)
     {
        print "Removing data from pruned files\n" if $verbose;
index d149b6a..96b4f8a 100644 (file)
@@ -94,6 +94,8 @@ sub find_db
     return $file;
 }
 
+sub base_dir { return shift->{base}; }
+
 sub create
 {
     my($self,$name)=@_;