Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/usr.sbin/pkg_install/delete Pull up revisions 1.35-1.36...
details: https://anonhg.NetBSD.org/src/rev/2ee1299dc3ad
branches: netbsd-1-6
changeset: 528267:2ee1299dc3ad
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Jun 28 12:43:57 2002 +0000
description:
Pull up revisions 1.35-1.36 (requested by taca in ticket #369):
- fix buffer size checks
- define PKG_PATTEN_MAX and PKG_SUFFIX_MAX and
use them instead of constants like 255.
- add asserts and buffer size checks.
- constify and make WARNS=2 clean.
- Fixes provided by Stoned Elipot <seb%script.jussieu.fr@localhost> in PR 17323
diffstat:
usr.sbin/pkg_install/delete/perform.c | 31 ++++++++++---------------------
1 files changed, 10 insertions(+), 21 deletions(-)
diffs (95 lines):
diff -r 3ed43991da7c -r 2ee1299dc3ad usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c Fri Jun 28 12:43:48 2002 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c Fri Jun 28 12:43:57 2002 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.34 2002/02/15 12:42:34 drochner Exp $ */
+/* $NetBSD: perform.c,v 1.34.2.1 2002/06/28 12:43:57 lukem Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.34 2002/02/15 12:42:34 drochner Exp $");
+__RCSID("$NetBSD: perform.c,v 1.34.2.1 2002/06/28 12:43:57 lukem Exp $");
#endif
#endif
@@ -73,7 +73,7 @@
static int require_find(char *, rec_find_t);
static int require_delete(char *, int);
static void require_print(void);
-static int undepend(const char *deppkgname, char *pkg2delname);
+static int undepend(const char *, void *);
static char LogDir[FILENAME_MAX];
static char linebuf[FILENAME_MAX];
@@ -84,17 +84,6 @@
static lpkg_head_t lpfindq;
static lpkg_head_t lpdelq;
-/*
- * Called to see if pkg is already installed as some other version,
- * note found version in "note".
- */
-static int
-note_whats_installed(const char *found, char *note)
-{
- (void) strcpy(note, found);
- return 0;
-}
-
static void
sanity_check(char *pkg)
{
@@ -118,9 +107,10 @@
* about to remove pkg2delname. This function is called from
* findmatchingname(), deppkgname is expanded from a (possible) pattern.
*/
-int
-undepend(const char *deppkgname, char *pkg2delname)
+static int
+undepend(const char *deppkgname, void *vp)
{
+ char *pkg2delname = vp;
char fname[FILENAME_MAX], ftmp[FILENAME_MAX];
char fbuf[FILENAME_MAX];
FILE *fp, *fpwr;
@@ -401,7 +391,6 @@
FILE *cfile;
package_t rPlist;
char *tmp;
- plist_t *p;
/* remove a direct req from our queue */
TAILQ_REMOVE(&reqq, lpp, lp_link);
@@ -541,7 +530,7 @@
char try[FILENAME_MAX];
snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkg);
if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
- find_fn, NULL) != 0) {
+ add_to_list_fn, &pkgs) != 0) {
return 0; /* we've just appended some names to the pkgs list,
* they will be processed after this package. */
}
@@ -675,7 +664,7 @@
}
int
-pkg_perform(lpkg_head_t *pkgs)
+pkg_perform(lpkg_head_t *pkghead)
{
int err_cnt = 0;
int oldcwd;
@@ -686,9 +675,9 @@
if (oldcwd == -1)
err(1, "cannot open \".\"");
- while ((lpp = TAILQ_FIRST(pkgs))) {
+ while ((lpp = TAILQ_FIRST(pkghead))) {
err_cnt += pkg_do(lpp->lp_name);
- TAILQ_REMOVE(pkgs, lpp, lp_link);
+ TAILQ_REMOVE(pkghead, lpp, lp_link);
free_lpkg(lpp);
if (fchdir(oldcwd) == FAIL)
err(1, "unable to change to previous directory");
Home |
Main Index |
Thread Index |
Old Index