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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
Claude
2026-09-24 09:16:04 -07:00
committed by Kyle Isom
parent ec8159ea2e
commit eaa605f548
+3 -1
View File
@@ -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 // Carry over permissions and (best effort; needs privilege to give a
// file away) ownership of the file being replaced. // file away) ownership of the file being replaced.
(void) kte::syscall::Fchmod(fd, dst_st.st_mode & 07777); (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 { } else {
// mkstemp creates 0600; a new file gets the usual 0666 & ~umask. // mkstemp creates 0600; a new file gets the usual 0666 & ~umask.
const mode_t mask = ::umask(0); const mode_t mask = ::umask(0);