Skip to content

Commit ccb1b25

Browse files
FileIOResult is not a std::expected or similar. Don't treat it that way.
1 parent 2ccd126 commit ccb1b25

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

libc/src/stdio/printf_core/vfprintf_internal.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ LIBC_INLINE FileIOResult fwrite_unlocked(const void *ptr, size_t size,
5555
// if there was an error, and errno may have previously been nonzero. Only
5656
// return errno if there was an error.
5757
auto bytes = ::fwrite_unlocked(ptr, size, nmemb, f);
58-
if (bytes == nmemb * size)
59-
return bytes;
60-
else
61-
return errno;
58+
return {bytes, bytes == nmemb * size ? 0 : errno};
6259
}
6360
#endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE
6461
} // namespace internal

0 commit comments

Comments
 (0)