Skip to content

Commit 64fad09

Browse files
Fix calculation to be against nmemb, not size.
1 parent 9b0318a commit 64fad09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libc/src/stdio/printf_core/vfprintf_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ LIBC_INLINE FileIOResult fwrite_unlocked(const void *ptr, size_t size,
5454
// which we need to propagate back into our code. fwrite only modifies errno
5555
// if there was an error, and errno may have previously been nonzero. Only
5656
// return errno if there was an error.
57-
size_t bytes = ::fwrite_unlocked(ptr, size, nmemb, f);
58-
return {bytes, bytes == size ? 0 : errno};
57+
size_t members_written = ::fwrite_unlocked(ptr, size, nmemb, f);
58+
return {members_written, members_written == nmemb ? 0 : errno};
5959
}
6060
#endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE
6161
} // namespace internal

0 commit comments

Comments
 (0)