Skip to content

Commit 5605eac

Browse files
oech3sylvestre
authored andcommitted
wc: replace unsafe sysconf by rustix
1 parent f058974 commit 5605eac

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/uu/wc/src/count_fast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::WordCountable;
1212
use std::io::{self, ErrorKind, Read};
1313

1414
#[cfg(unix)]
15-
use libc::{_SC_PAGESIZE, S_IFREG, sysconf};
15+
use libc::S_IFREG;
1616
#[cfg(unix)]
1717
use std::io::{Seek, SeekFrom};
1818
#[cfg(unix)]
@@ -122,7 +122,7 @@ pub(crate) fn count_bytes_fast<T: WordCountable>(handle: &mut T) -> (usize, Opti
122122
&& (stat.st_mode as libc::mode_t & S_IFREG) != 0
123123
&& stat.st_size > 0
124124
{
125-
let sys_page_size = unsafe { sysconf(_SC_PAGESIZE) as usize };
125+
let sys_page_size = rustix::param::page_size();
126126
if !(stat.st_size as usize).is_multiple_of(sys_page_size) {
127127
// regular file or file from /proc, /sys and similar pseudo-filesystems
128128
// with size that is NOT a multiple of system page size

0 commit comments

Comments
 (0)