aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-07-04 17:16:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-07-04 17:16:34 +0000
commit269d491b6a71b5c3107681d95dcfa7b2baa4b538 (patch)
treedb35559a7fc4c6213d4cbf24a5ba3a8c60ad9775
parent449e5bc2ad1d83de50779686679de6158ae9ff03 (diff)
remove the usage of setvbuf() and use fflush() instead if no buffering should
be done on the output
-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 {