mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
libstdbuf: remove eprintln! causing 2>/dev/full abort
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
|
||||
use ctor::ctor;
|
||||
use libc::{_IOFBF, _IOLBF, _IONBF, FILE, c_char, c_int, fileno, size_t};
|
||||
use std::env;
|
||||
use std::ptr;
|
||||
use std::io::{Write, stderr};
|
||||
use std::{env, ptr};
|
||||
|
||||
// This runs automatically when the library is loaded via LD_PRELOAD
|
||||
#[ctor]
|
||||
@@ -210,7 +210,7 @@ fn set_buffer(stream: *mut FILE, value: &str) {
|
||||
"L" => (_IOLBF, 0_usize),
|
||||
input => {
|
||||
let Ok(buff_size) = input.parse::<usize>() else {
|
||||
eprintln!("failed to allocate a {value} byte stdio buffer");
|
||||
let _ = writeln!(stderr(), "failed to allocate a {value} byte stdio buffer");
|
||||
std::process::exit(1);
|
||||
};
|
||||
(_IOFBF, buff_size as size_t)
|
||||
@@ -223,9 +223,11 @@ fn set_buffer(stream: *mut FILE, value: &str) {
|
||||
res = libc::setvbuf(stream, buffer, mode, size);
|
||||
}
|
||||
if res != 0 {
|
||||
eprintln!("could not set buffering of {} to mode {mode}", unsafe {
|
||||
fileno(stream)
|
||||
});
|
||||
let _ = writeln!(
|
||||
stderr(),
|
||||
"could not set buffering of {} to mode {mode}",
|
||||
unsafe { fileno(stream) }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user