Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Sep 2001 15:04:16 -0700
From:      Bill Swingle <unfurl@dub.net>
To:        FreeBSD Hackers <hackers@freebsd.org>
Subject:   tiny patch to pkg_add
Message-ID:  <20010907150416.A38565@dub.net>

next in thread | raw e-mail | index | archive | help

--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 - <unfurl@(dub.net|freebsd.org)>
-=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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010907150416.A38565>