From 81088f238e4996bb1811bd7b7dc48d9dc9f54c24 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 30 Mar 2023 11:16:09 +0200 Subject: [PATCH] fix: do a single write to stderr from the statvfs_ldpreload --- libs/statvfs_ldpreload/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/statvfs_ldpreload/src/lib.rs b/libs/statvfs_ldpreload/src/lib.rs index a884611735..aff62cfee9 100644 --- a/libs/statvfs_ldpreload/src/lib.rs +++ b/libs/statvfs_ldpreload/src/lib.rs @@ -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 {