Skip to content

Commit

Permalink
ar: runtime error for bad args (#484)
Browse files Browse the repository at this point in the history
%perl ar -a -x
Uncaught exception from user code:
	fileparse(): need a valid pathname at ar line 40.
	File::Basename::fileparse(undef) called at /usr/local/lib/perl5/5.34.1/File/Basename.pm line 222
	File::Basename::basename(undef) called at ar line 40

* Flags -a and -b require extra position value in ARGV; if this is missing it is reasonable to print usage and exit
  • Loading branch information
mknos committed Mar 6, 2024
1 parent 0e31314 commit 9365745
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/ar
Expand Up @@ -34,7 +34,9 @@ $opt_b |= $opt_i;
# extract position offset
my $position;
if ($opt_a || $opt_b) {
$position = basename(shift);
my $val = shift;
usage() unless defined $val;
$position = basename($val);
}

# the archive filename
Expand Down

0 comments on commit 9365745

Please sign in to comment.