Fix fread() with 2gb+ sizes

This commit is contained in:
Justine Tunney 2024-05-24 19:28:23 -07:00
parent 5f61d273e4
commit ed93fc3dd7
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
8 changed files with 254 additions and 119 deletions

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/iovec.internal.h"
#include "libc/calls/struct/iovec.h"
#include "libc/dce.h"
#include "libc/fmt/internal.h"
#include "libc/limits.h"
@ -42,7 +42,7 @@ static int vdprintf_putc(const char *s, struct VdprintfState *t, size_t n) {
iov[0].iov_len = t->n;
iov[1].iov_base = (void *)s;
iov[1].iov_len = n;
if (__robust_writev(t->fd, iov, 2) == -1) {
if (writev(t->fd, iov, 2) == -1) {
return -1;
}
t->t += t->n;
@ -68,7 +68,7 @@ int vdprintf(int fd, const char *fmt, va_list va) {
if (t.n) {
iov[0].iov_base = t.b;
iov[0].iov_len = t.n;
if (__robust_writev(t.fd, iov, 1) == -1) {
if (writev(t.fd, iov, 1) == -1) {
return -1;
}
t.t += t.n;