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/info Pull up revisions 1.28-1.29 (...



details:   https://anonhg.NetBSD.org/src/rev/4994c0361f16
branches:  netbsd-1-6
changeset: 528269:4994c0361f16
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 12:44:14 2002 +0000

description:
Pull up revisions 1.28-1.29 (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/info/main.c |  23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diffs (57 lines):

diff -r 7dc3aae8eb0f -r 4994c0361f16 usr.sbin/pkg_install/info/main.c
--- a/usr.sbin/pkg_install/info/main.c  Fri Jun 28 12:44:06 2002 +0000
+++ b/usr.sbin/pkg_install/info/main.c  Fri Jun 28 12:44:14 2002 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.27 2001/08/21 18:38:40 yamt Exp $   */
+/*     $NetBSD: main.c,v 1.27.2.1 2002/06/28 12:44:14 lukem Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.27 2001/08/21 18:38:40 yamt Exp $");
+__RCSID("$NetBSD: main.c,v 1.27.2.1 2002/06/28 12:44:14 lukem Exp $");
 #endif
 #endif
 
@@ -38,7 +38,7 @@
 #include "lib.h"
 #include "info.h"
 
-static char Options[] = "aBbcDde:fFhIikLl:mnpqRrsSvV";
+static const char Options[] = "aBbcDde:fFhIikLl:mnpqRrsSvV";
 
 int     Flags = 0;
 Boolean AllInstalled = FALSE;
@@ -62,21 +62,6 @@
 }
 
 int
-find_fn(const char *pkg, char *data)
-{
-       lpkg_t *lpp;
-       char fn[FILENAME_MAX];
-
-       snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
-       if (!isfile(fn)) {      /* might as well use sanity_check() */
-               lpp = alloc_lpkg(pkg);
-               TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
-       }
-
-       return 0;
-}
-
-int
 main(int argc, char **argv)
 {
        int     ch, rc;
@@ -251,7 +236,7 @@
                                errx(1, "No matching pkg for %s.", *argv);
                } else {
                        if (ispkgpattern(*argv)) {
-                               if (findmatchingname(_pkgdb_getPKGDB_DIR(), *argv, find_fn, NULL) == 0)
+                               if (findmatchingname(_pkgdb_getPKGDB_DIR(), *argv, add_to_list_fn, &pkgs) == 0)
                                        errx(1, "No matching pkg for %s.", *argv);
                        } else {
                                lpp = alloc_lpkg(*argv);



Home | Main Index | Thread Index | Old Index