pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/42213: pkg_install-20090816 introduces a major pointer bug to pkg_add.



Please try the attached patch.

Joerg
Index: lib/pkgdb.c
===================================================================
RCS file: 
/home/joerg/repo/netbsd/pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c,v
retrieving revision 1.35
diff -u -p -r1.35 pkgdb.c
--- lib/pkgdb.c 11 Sep 2009 18:00:13 -0000      1.35
+++ lib/pkgdb.c 22 Oct 2009 22:09:01 -0000
@@ -78,7 +78,6 @@ __RCSID("$NetBSD: pkgdb.c,v 1.35 2009/09
 
 static DB   *pkgdbp;
 static char *pkgdb_dir = NULL;
-static char  pkgdb_cache[MaxPathSize];
 
 /*
  *  Open the pkg-database
@@ -310,8 +309,13 @@ _pkgdb_getPKGDB_DIR(void)
 void
 _pkgdb_setPKGDB_DIR(const char *dir)
 {
-       (void) snprintf(pkgdb_cache, sizeof(pkgdb_cache), "%s", dir);
-       pkgdb_dir = pkgdb_cache;
+       char *new_dir;
+
+       if (dir == pkgdb_dir)
+               return;
+       new_dir = xstrdup(dir);
+       free(pkgdb_dir);
+       pkgdb_dir = new_dir;
 }
 
 char *


Home | Main Index | Thread Index | Old Index