[libc-commits] [libc] [libc] Treat -1 from fopencookie callbacks as an error (PR #236970)

Mike Lothian via libc-commits libc-commits at lists.llvm.org
Sun Nov 1 11:31:01 PST 2026


================
@@ -41,20 +48,29 @@ class CookieFile : public LIBC_NAMESPACE::File {
         cookie(c), ops(cops) {}
 };
 
+// A callback reports failure by returning -1 and setting errno.
+int callback_error() { return libc_errno != 0 ? libc_errno : EIO; }
----------------
FireBurn wrote:

The helper is gone and the errno read with it. Both callbacks now return EIO inline when the callback returns a negative value, and the test expects EIO

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


More information about the libc-commits mailing list