int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
{
+ int rc;
struct OutStruct *out=(struct OutStruct *)stream;
struct Configurable *config = out->config;
if(out && !out->stream) {
out->stream=fopen(out->filename, "wb");
if(!out->stream)
return -1; /* failure */
- if(config->nobuffer) {
- /* disable output buffering */
-#ifdef HAVE_SETVBUF
- setvbuf(out->stream, NULL, _IONBF, 0);
-#endif
- }
}
if(config->recvpersecond) {
config->lastrecvtime = now;
}
- return fwrite(buffer, size, nmemb, out->stream);
+ rc = fwrite(buffer, size, nmemb, out->stream);
+
+ if(config->nobuffer)
+ /* disable output buffering */
+ fflush(out->stream);
+
+ return rc;
}
struct InStruct {