Subject: Re: pkgtools on NetBSD 1.3.2
To: Paul Hoffman <phoffman@proper.com>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: tech-pkg
Date: 06/07/2000 04:11:40
On Tue, 6 Jun 2000, Paul Hoffman wrote:
> Any clues on how I can move forwards.

Use this patch:

Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/pkg_install/delete/main.c,v
retrieving revision 1.15
diff -u -r1.15 main.c
--- main.c      2000/05/11 14:13:13     1.15
+++ main.c      2000/06/07 02:09:47
@@ -58,16 +58,13 @@
 find_fn(const char *pkg, char *data)
 {
        lpkg_t *lpp;
-       char *fn;
+       char fn[FILENAME_MAX];
 
-       asprintf(&fn, "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
-       if (fn == NULL)
-               errx(1, "Out of memory while scanning pkgs.");
+       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);
        }
-       free(fn);
 
        return 0;
 }


 - Hubert

-- 
NetBSD - because Unix isn't just #include <linux.h>, i386, ILP32, ELF, ...!