Skip to content

Commit

Permalink
touch: -r argument truth check (#563)
Browse files Browse the repository at this point in the history
* Option -r takes a file argument to copy stat() data from
* Fix issue where filename of "0" is ignored because perl treated it as no-r-argument-given
  • Loading branch information
mknos committed Apr 17, 2024
1 parent 72fe391 commit 26c385f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/touch
Expand Up @@ -40,7 +40,7 @@ my $modification_time = exists $options {m} || !exists $options {a};
my $no_create = exists $options {c};

my ($atime, $mtime, $special_time);
if ($options {r}) {
if (defined $options{'r'}) {
($atime, $mtime) = (stat $options {r}) [8, 9] or die "$options{r}: $!\n";
$special_time = 1;
}
Expand Down

0 comments on commit 26c385f

Please sign in to comment.