From owner-freebsd-hackers Fri Sep 7 15: 4:21 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from magnesium.net (toxic.magnesium.net [207.154.84.15]) by hub.freebsd.org (Postfix) with SMTP id 3108D37B403 for ; Fri, 7 Sep 2001 15:04:17 -0700 (PDT) Received: (qmail 39266 invoked by uid 1001); 7 Sep 2001 22:04:16 -0000 Date: 7 Sep 2001 15:04:16 -0700 Date: Fri, 7 Sep 2001 15:04:16 -0700 From: Bill Swingle To: FreeBSD Hackers Subject: tiny patch to pkg_add Message-ID: <20010907150416.A38565@dub.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Operating-System: FreeBSD toxic.magnesium.net 4.3-STABLE FreeBSD 4.3-STABLE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ok, So this represents my most significant effort to date to fix something in C. It took me far too long to identify where the one line fix needed to go and even longer to figure out how to do it in C.=20 Here's the problem that this fixes: When using "pkg_add -r" to add multiple packages=20 (i.e. "pkg_add -r foo bar baz") pkg_add was dying after adding the first package because it was botching the URL for every package after the initial one. It looked a bit like this: # pkg_add -r xonix nethack an Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4.4-release/Latest/xo= nix.tgz... Done. Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packa= ges-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/package= s-4.4-release/Latest/nethack.tgz: File unavailable (e.g., file not found, n= o access) pkg_add: unable to fetch `ftp://ftp.freebsd.org/pub/FreeBSD/ports= /i386/packages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i= 386/packages-4.4-release/Latest/nethack.tgz' by URL Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packa= ges-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/package= s-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-= 4.4-release/Latest/an.tgz: File unavailable (e.g., file not found, no acces= s) pkg_add: unable to fetch `ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/p= ackages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/pac= kages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packa= ges-4.4-release/Latest/an.tgz' by URL Anyway, it's an easy fix but my real question is, is this the correct way to destroy the value of a variable in C? Here's my patch: --- src/usr.sbin/pkg_install/add/main.c Fri Sep 7 15:02:17 2001 +++ src/usr.sbin/pkg_install/add/main.c.orig Fri Sep 7 13:11:40 2001 @@ -189,7 +189,6 @@ } } } - strlcpy(packagesite, "", sizeof(packagesite)); } } /* If no packages, yelp */ -Bill --=20 -=3D| Bill Swingle - -=3D| Every message PGP signed -=3D| Fingerprint: C1E3 49D1 EFC9 3EE0 EA6E 6414 5200 1C95 8E09 0223 -=3D| Different all twisty a of in maze are you, passages little --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7mURgUgAclY4JAiMRAjJqAKC+PuHWeC/j6YjqV3Zz5MNg3rXvuACglwaU SE5wSsdzUH76JqTjqQR2HJM= =hoWr -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message