aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 6b84f3f33..a40bc8be7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2063,6 +2063,7 @@ struct OutStruct {
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) {
@@ -2070,12 +2071,6 @@ int my_fwrite(void *buffer, size_t size, size_t nmemb, void *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) {
@@ -2098,7 +2093,13 @@ int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
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 {