ref: 0c3e3901587c2777218d5c0749db22fd5f9669b5
parent: d481312cf28aa0d662f5699c33e6f1f4c0061bee
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Oct 17 14:20:01 EDT 2018
[lib/c] Initialize pointers of FILE After moving to a allocation on demand the pointers are not longer initialized, so it means that it is impossible to read or write a byte using stdio.
--- a/lib/c/__getc.c
+++ b/lib/c/__getc.c
@@ -27,7 +27,9 @@
errno = ENOMEM;
return EOF;
}
+ fp->len = BUFSIZ;
fp->flags |= _IOALLOC;
+ fp->lp = fp->rp = fp->wp = fp->buf;
}
if ((cnt = _read(fp->fd, fp->buf, fp->len)) <= 0) {
--- a/lib/c/__putc.c
+++ b/lib/c/__putc.c
@@ -50,7 +50,9 @@
errno = ENOMEM;
return EOF;
}
+ fp->len = BUFSIZ;
fp->flags |= _IOALLOC;
+ fp->lp = fp->rp = fp->wp = fp->buf;
}
if (first) {