Skip to content

Commit 19c94ed

Browse files
authored
also cater for the same file listed twice
1 parent 165f960 commit 19c94ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bin/ls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,14 @@ if ($#ARGV < 0) {
520520
if (@Files) {
521521
$First = 0;
522522
my %attrs;
523+
my @okfiles;
523524
foreach (@Files) {
524525
my @ret = DirEntries(\%Options, $_);
525526
next unless @ret; # stat() failed
526527
%attrs = (%attrs, %{ $ret[-1] });
528+
push @okfiles, $_;
527529
}
528-
my @sorted = Order(\%Options, \%Attributes, keys %attrs);
530+
my @sorted = Order(\%Options, \%Attributes, @okfiles);
529531
List('.', \%Options, 0, 0, @sorted, \%attrs);
530532
}
531533
for my $Arg (@Dirs) {

0 commit comments

Comments
 (0)