[libcxx-commits] [PATCH] D158930: [libc++][print] Fixes error reporting.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 12 10:35:42 PDT 2023
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/print:218-219
+ // On POSIX errno is set by fwrite. This is not required by the C standard.
+ errno = 0;
size_t __size = fwrite(__str.data(), 1, __str.size(), __stream);
----------------
I am a bit concerned with the direct usage of `errno` here. What about thread safety?
IMO the previous approach with `ferror` made more sense, we just shouldn't be using the return value of `ferror` as more than a zero/non-zero indicator. WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158930/new/
https://reviews.llvm.org/D158930
More information about the libcxx-commits
mailing list