commit 4851eeb93b663c97ff3884a93d36bdc6e77fe73e from: Alex Arx via: Alex Arch date: Sun Mar 16 08:11:35 2025 UTC use our own directory processing for the list command commit - 243f1a27b4b7edd416aff0664b10af30e24698e9 commit + 4851eeb93b663c97ff3884a93d36bdc6e77fe73e blob - 65d916305182bb5e4bbec8d7ab3625977a8c960e blob + 68d79c963f04d9b580bdc76e05ba6245fea11974 --- secstore +++ secstore @@ -126,25 +126,43 @@ sub secstore_add { } } +# find $file +sub find { + my $path = shift @_; + my $f = basename $path; + + if ($f eq "." || $f eq "..") { + return 1; + } + + if (-d $path) { + my $dh; + if (!opendir $dh, $path) { + print STDERR "Can't open directory $path: $!\n"; + return 0; + } + while (readdir $dh) { + find($path . "/" . $_); + } + } else { + print "$path\n"; + } + + return 1; + +} + + # secstore_list # -# Produce a listing of files in the gpm directory, using the SECSTORE_LSCMD -# environment variable if defined. +# Produce a listing of files in the secstore directory. sub secstore_list { - my $cmd = $ENV{SECSTORE_LSCMD}; - - unless (defined $cmd) { - opendir my $dh, "." or die "couldn't open directory .: $!\n"; - while (readdir $dh) { - if ($_ ne "." && $_ ne ".." && -d $_) { - $cmd = "find . -type f | sed 's,^\./,,'"; - last; - } - } - $cmd = "ls" unless defined $cmd; + my $status = 1; + opendir my $dh, "." or die "couldn't open directory .: $!\n"; + while (readdir $dh) { + $status = find($_) ? $status : 0; } - system $cmd; - $? == 0 or exit 1; + exit $status; } # move_file from to