diff --git a/TODO.txt b/TODO.txt index 1383972..14969e0 100644 --- a/TODO.txt +++ b/TODO.txt @@ -14,8 +14,8 @@ Milestone: v0.3.0 [~] Stream API [~] Implementation [ ] Convert all code that deals with I/O - [ ] Multi-output (proof of concept) - [ ] Memory streams (proof of concept) + [!] Multi-output (proof of concept) + [!] Memory streams (proof of concept) [ ] TLS [ ] SOCKS [x] Move/convert UtilStreamCopy() diff --git a/src/Io/IoFile.c b/src/Io/IoFile.c index fe44291..9c3729a 100644 --- a/src/Io/IoFile.c +++ b/src/Io/IoFile.c @@ -37,8 +37,15 @@ static ssize_t IoWriteFile(void *cookie, void *buf, size_t nBytes) { FILE *fp = cookie; + size_t res = fwrite(buf, 1, nBytes, fp); - return fwrite(buf, 1, nBytes, fp); + /* + * fwrite() may be buffered on some platforms, but at this low level, + * it should not be; buffering happens in Stream, not Io. + */ + fflush(fp); + + return res; } static off_t