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

Marcell Leleszi via libc-commits libc-commits at lists.llvm.org
Fri Oct 17 08:28:54 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};
----------------
mleleszi wrote:

@michaelrj-google Is it ok to use the global errno here when using the system implementation? Can't see another way of propagating errors in that case

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


More information about the libc-commits mailing list