1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

head: saturate to max int size on 32 bit platforms

This commit is contained in:
Jeremy Smart 2025-04-11 22:48:50 -04:00 committed by Sylvestre Ledru
parent cc1112660a
commit 37eee0e1e6

View file

@ -282,13 +282,7 @@ fn read_n_lines(input: &mut impl io::BufRead, n: u64, separator: u8) -> io::Resu
}
fn catch_too_large_numbers_in_backwards_bytes_or_lines(n: u64) -> Option<usize> {
match usize::try_from(n) {
Ok(value) => Some(value),
Err(e) => {
show!(HeadError::NumTooLarge(e));
None
}
}
usize::try_from(n).ok()
}
fn read_but_last_n_bytes(mut input: impl Read, n: u64) -> io::Result<u64> {