From eaa605f5480ff0924c36fa678d705bd17d050a4e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 24 Sep 2026 04:32:24 +0000 Subject: [PATCH] Buffer: fix Release build (unused fchown result) glibc marks fchown warn_unused_result; with optimisation and _FORTIFY_SOURCE a (void) cast does not silence it, and -Werror failed the Release build. Check the result explicitly instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB --- Buffer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Buffer.cc b/Buffer.cc index 830aa75..a34a390 100644 --- a/Buffer.cc +++ b/Buffer.cc @@ -214,7 +214,9 @@ atomic_write_file(const std::string &path_in, const char *data, std::size_t len, // Carry over permissions and (best effort; needs privilege to give a // file away) ownership of the file being replaced. (void) kte::syscall::Fchmod(fd, dst_st.st_mode & 07777); - (void) ::fchown(fd, dst_st.st_uid, dst_st.st_gid); + if (::fchown(fd, dst_st.st_uid, dst_st.st_gid) != 0) { + // Expected without privilege when the owner differs; keep ours. + } } else { // mkstemp creates 0600; a new file gets the usual 0666 & ~umask. const mode_t mask = ::umask(0);