cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Bug#278691: -v to stderr

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 6 Nov 2004 20:16:39 +0100 (CET)

On Sat, 6 Nov 2004, Ian Gulliver wrote:

> pipe(fd);

> Might leak at most 1 fd, but seems significantly more portable and
> standards-compliant.

This is indeed a clever approach. I wouldn't even call it a "leak" since it
would only be one extra file descriptor in use and that will be closed when
the program exits.

However, this code assumes the presence of pipe() so we'll need an #ifdef
HAVE_PIPE around this code (and the apropriate configure.ac patch). I don't
know if that is bad or not, since I believe the only environments that can end
up with these file descriptors closed are unix-style and they have pipe().

If we can figure out a system call that A) only creates one new file
descriptor and B) works on most modern operating systems, we'd have an even
better approach. But as I said, I'm not sure it would ever be necessary.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-11-06