tiny patch to pkg_add

[ Available lists | Index of freebsd-hackers | Month of Sep 2001 | Week of 7 Sep 2001 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Bill Swingle <unfurl@dub.net>
Date
7 Sep 2001 15:04:21
Subject
tiny patch to pkg_add
Message-ID
20010907150416.A38565@dub.net


[ Hide this part ]
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.

Here's the problem that this fixes:

When using "pkg_add -r" to add multiple packages
(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/xonix.tgz... Done.
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4.4-release/Latest/nethack.tgz: File unavailable (e.g., file not found, no 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/i386/packages-4.4-release/Latest/nethack.tgz' by URL
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-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 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/i386/packages-4.4-release/Latest/ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-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

--
-=| Bill Swingle - <unfurl@(dub.net|freebsd.org)>
-=| Every message PGP signed
-=| Fingerprint: C1E3 49D1 EFC9 3EE0 EA6E 6414 5200 1C95 8E09 0223
-=| Different all twisty a of in maze are you, passages little



[ Show this part (application/pgp-signature) ]

Elapsed time: 0.094 seconds