Skip to content

Commit

Permalink
tar: raise error for directory argument to -f
Browse files Browse the repository at this point in the history
* Adding die() for directory argument ensures tar doesn't exit with a success code
* Test command: perl tar -tf .
* Found when testing against GNU tar
  • Loading branch information
mknos authored Nov 21, 2023
1 parent 231b9d4 commit cbf437f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bin/tar
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ else

if ($opt{'f'})
{
die("Cannot open '$opt{'f'}': is a directory\n") if (-d $opt{'f'});
open(STDIN, '<', $opt{'f'}) || die "Cannot open $opt{'f'}:$!";
}
binmode(STDIN);
Expand Down

0 comments on commit cbf437f

Please sign in to comment.