Date: Fri, 5 Nov 2010 11:20:09 -0400 From: Mark Johnston <markjdb@gmail.com> To: Nick Hibma <nick@van-laarhoven.org> Cc: freebsd-current@freebsd.org Subject: Re: [Patch] libfetch - closing the cached FTP connection Message-ID: <20101105152009.GB1437@mark-laptop-bsd.mark-home> In-Reply-To: <A72115A0-00E4-4FDB-974C-E06D31116794@van-laarhoven.org> References: <20101024231119.GA2123@mark-laptop-bsd.mark-home> <20101024231642.GB2123@mark-laptop-bsd.mark-home> <A72115A0-00E4-4FDB-974C-E06D31116794@van-laarhoven.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101105152009.GB1437>