fix: do a single write to stderr from the statvfs_ldpreload

This commit is contained in:
Christian Schwarz
2023-03-30 11:16:09 +02:00
parent d1b398702d
commit 81088f238e

View File

@@ -74,10 +74,14 @@ pub extern "C" fn fstatvfs(_fd: libc::c_int, buf: *mut libc::statvfs64) -> libc:
config: &config,
invocation_number,
};
eprintln!(
let status_line = format!(
"statvfs_ldpreload status: {}",
serde_json::to_string(&status).unwrap()
);
// Do a single write() system call to the stderr file descriptor.
// The kernel should serialize it with other writes to stderr,
// as long as the write doesn't cross page boundary.
eprintln!("{}", status_line);
// mock the statvfs call
match config.mock {