Skip to content

patch: reject negative --fuzz value #719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bin/patch
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ if (defined $patch->{'directory'}) {
die "failed to change to directory '$patch->{directory}': $!\n";
}
}
if (defined $patch->{'fuzz'} && $patch->{'fuzz'} < 0) {
die "$0: fuzz factor is negative: $patch->{fuzz}\n";
}
tie *PATCH, Pushback => $patchfile or die "Can't open '$patchfile': $!";

# Extract patches from patchfile. We unread/pushback lines by printing to
Expand Down Expand Up @@ -344,7 +347,7 @@ sub bless {
$self->{o_lines} = 0; # lines written to 'out' file
$self->{hunk} = 1; # current hunk number
$self->{rejects} = []; # save rejected hunks here
$self->{fuzz} = 2 unless defined $self->{fuzz} && $self->{fuzz} >= 0;
$self->{'fuzz'} = 2 unless defined $self->{'fuzz'};
$self->{ifdef} = '' unless defined $self->{ifdef};

# Skip patch?
Expand Down
Loading