[libc-commits] [libc] [libc] Add printf error handling (PR #162876)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Oct 31 10:04:21 PDT 2025


================
@@ -47,9 +49,9 @@ LIBC_INLINE void flockfile(::FILE *f) { ::flockfile(f); }
 
 LIBC_INLINE void funlockfile(::FILE *f) { ::funlockfile(f); }
 
-LIBC_INLINE size_t fwrite_unlocked(const void *ptr, size_t size, size_t nmemb,
-                                   ::FILE *f) {
-  return ::fwrite_unlocked(ptr, size, nmemb, f);
+LIBC_INLINE FileIOResult fwrite_unlocked(const void *ptr, size_t size,
+                                         size_t nmemb, ::FILE *f) {
+  return {::fwrite_unlocked(ptr, size, nmemb, f), errno};
----------------
michaelrj-google wrote:

I think you're right that we should use the system errno directly in this case. We need to read from it so it can be propagated back into the rest of our code. Please add a comment explaining that this specifically needs to be the system errno.

https://github.com/llvm/llvm-project/pull/162876


More information about the libc-commits mailing list