cURL / Mailing Lists / curl-users / Single Mail

curl-users

setvbuf considered dangerous

From: Rick Richardson <rickr_at_mn.rr.com>
Date: Thu, 26 Jun 2003 00:43:01 -0500

I've been having trouble with getting unbuffered output from curl.
I guess old versions forgot to call setvbuf(). So I tried 7.10.5
on Redhat 9. Here we have the trouble that setvbuf() doesn't seem
to work.

setvbuf() has been broken so many ways in various Unixes over the
years (calling args reversed, etc). that I think its best to avoid it
altogether.

I made this change at the end of my_fwrite() in main.c
and now it works fine...

  int rc;

  rc = fwrite(buffer, size, nmemb, out->stream);
  if (config->nobuffer)
    fflush(out->stream);
  return rc;

For safeties sake, I urge adoption of this change.

-Rick

-- 
Rick Richardson  rickr@mn.rr.com        http://home.mn.rr.com/richardsons/
Stock information at your fingertips:   http://linuxtrade.0catch.com/
"Trees grow, we use them." -- Daxxx
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
Received on 2003-06-26