mirror of
				https://codeberg.org/h3xx/simplify_static_dir
				synced 2024-08-14 23:57:24 +00:00 
			
		
		
		
	Fix issue where mixed readonly/read-write dirs didn't hard link
This commit is contained in:
		
							parent
							
								
									76da187807
								
							
						
					
					
						commit
						8fdf3069ba
					
				
					 2 changed files with 14 additions and 3 deletions
				
			
		|  | @ -145,17 +145,23 @@ sub instructions { | |||
|         my ($oldest_entry) = _oldest_mtime(@{$bucket}); | ||||
| 
 | ||||
|         # Limit link/unlink operations to files in non-readonly directories | ||||
|         my @non_readonly; | ||||
|         my (@non_readonly, @readonly); | ||||
|         foreach my $entry (@{$bucket}) { | ||||
|             unless (-w $entry->{dirname}) { | ||||
|                 carp "Warning: $entry->{name} not able to be unlinked!"; | ||||
|                 push @readonly, $entry; | ||||
|             } else { | ||||
|                 push @non_readonly, $entry; | ||||
|             } | ||||
|             push @non_readonly, $entry; | ||||
|         } | ||||
| 
 | ||||
|         # Of the linkable files, find the file most embedded in the file system | ||||
|         my @to_link = _more_linked(@non_readonly); | ||||
|         my $most_linked_entry = shift @to_link; | ||||
|         @readonly = _more_linked(@readonly); | ||||
| 
 | ||||
|         # Select a basis for linkage, either the most-linked readonly entry (if | ||||
|         # any) or the most linked of the read-write entries. | ||||
|         my $most_linked_entry = shift @readonly // shift @to_link; | ||||
|         foreach my $entry (@to_link) { | ||||
|             # XXX there shouldn't be a need to update entries' link counts, | ||||
|             # since this generates all the instructions at once | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue