[Patch] libfetch - closing the cached FTP connection

Mark Johnston markjdb at gmail.com
Fri Nov 5 15:20:30 UTC 2010


On Fri, Nov 05, 2010 at 09:38:24AM +0100, Nick Hibma wrote:
> Mark,
> 
> My 2 cents: Isn't it more appropriate to set FD_CLOEXEC on the fd?
> 
> 	fcntl(fd, F_SETFD, FD_CLOEXEC); 
> 
> It doesn't sound like you ever want to have a cached connection be copied into the child. Mum and child calling daddy using the same phone line isn't going to make the conversation any easier for daddy.
> 
> Cheers,
> 
> Nick

The problem is that libfetch's ftp functions use an interface set up by
funopen(3), so functions like fetchGetURL return a FILE*. However, I
can't use something like fileno(3) to get the descriptor to pass to
fcntl, because libfetch's FILE * is actually a struct ftpio *, which is
only in ftp.c, i.e. not in the headers.

I think using fcntl is nicer than having a "close the cached connection"
function, but I don't think I can get around this problem without
changing something in libfetch.

Thanks,
-Mark


More information about the freebsd-current mailing list