Skip to content

Commit

Permalink
shred: only run zero when the file isn't empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Mar 23, 2024
1 parent cf3fe0e commit 6d89f96
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/uu/shred/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,11 @@ fn wipe_file(
pass_sequence[i * (n_passes - 1) / (n_random - 1)] = PassType::Random;
}
}
}
// --zero specifies whether we want one final pass of 0x00 on our file
if zero {
pass_sequence.push(PassType::Pattern(PATTERNS[0]));

// --zero specifies whether we want one final pass of 0x00 on our file
if zero {
pass_sequence.push(PassType::Pattern(PATTERNS[0]));
}
}

let total_passes = pass_sequence.len();
Expand Down

0 comments on commit 6d89f96

Please sign in to comment.