From owner-cvs-all Thu Oct 24 18:23: 2 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A541A37B406 for ; Thu, 24 Oct 2002 18:23:01 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id DE4C343E75 for ; Thu, 24 Oct 2002 18:23:00 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 70456 invoked by uid 1000); 25 Oct 2002 01:23:02 -0000 Date: Thu, 24 Oct 2002 18:23:02 -0700 (PDT) From: Nate Lawson To: Nate Lawson Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libfetch ftp.c In-Reply-To: <200210250117.g9P1HWVl045395@repoman.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 24 Oct 2002, Nate Lawson wrote: > njl 2002/10/24 18:17:32 PDT > > Modified files: > lib/libfetch ftp.c > Log: > The FTP connection caching needs a better interface -- connections are > closed through _fetch_close() which is the only one who knows the connection > REALLY was closed (since ref -> 0). However, FTP keeps its own local > cached_connection and checks if it is valid by comparing it to NULL. This > is bogus since it may have been freed elsewhere by _fetch_close(). > > This change checks if we are closing the cached_connection and the ref is 1 > (soon to be 0). If so, set cached_connection to NULL so we don't > accidentally reuse it. The REAL fix should be to move connection caching > to the common.c level (_fetch_* functions) and NULL the cache(s) in > _fetch_close(). Then all layers could benefit from caching. > > Revision Changes Path > 1.83 +4 -0 src/lib/libfetch/ftp.c Tested with pkg_add -r xpdf-1.01 which succeeded. tjr's patch was the first to fix the crash caused by this and this patch fixes other potential error cases, for example: _ftp_cached_connect, _fetch_close, _ftp_cached_connect -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message