Skip to content

Commit 40373c7

Browse files
committed
NAME_MAX fix for Linux builds
1 parent 1aa16bf commit 40373c7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

text/csplit.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,10 @@ fn parse_operands(args: &Args) -> io::Result<SplitOps> {
591591

592592
/// Validates that the prefix + suffix won't exceed NAME_MAX
593593
fn validate_prefix(prefix: &str, suffix_len: u8) -> io::Result<()> {
594-
// Get NAME_MAX for the current directory
595-
#[cfg(target_os = "macos")]
594+
// POSIX NAME_MAX is typically 255 on most systems (macOS, Linux, BSDs)
595+
// Using a constant avoids platform-specific libc differences
596596
const NAME_MAX: usize = 255;
597597

598-
#[cfg(not(target_os = "macos"))]
599-
const NAME_MAX: usize = libc::NAME_MAX as usize;
600-
601598
// Maximum filename length is prefix + suffix digits
602599
let max_filename_len = prefix.len() + suffix_len as usize;
603600

0 commit comments

Comments
 (0)