[libc-commits] [libc] [libc] Treat -1 from fopencookie callbacks as an error (PR #236970)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Thu Oct 29 14:48:55 PDT 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; }
----------------
michaelrj-google wrote:
why does this need to be a function if it's just one line? Also why is it reading `errno`? No internal function should set errno.
https://github.com/llvm/llvm-project/pull/236970
More information about the libc-commits
mailing list