pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib pkg_install-20091022:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9f8e5c90a236
branches:  trunk
changeset: 400603:9f8e5c90a236
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Thu Oct 22 22:51:29 2009 +0000

description:
pkg_install-20091022:
Do not overwrite a string with itself using snprintf. This breaks
setting the pkgdb directory internally on Linux. Explicitly check
if the string is the same and otherwise just use xstrdup.

diffstat:

 pkgtools/pkg_install/files/lib/pkgdb.c   |  14 +++++++++-----
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 22a0e1ab8342 -r 9f8e5c90a236 pkgtools/pkg_install/files/lib/pkgdb.c
--- a/pkgtools/pkg_install/files/lib/pkgdb.c    Thu Oct 22 22:31:26 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c    Thu Oct 22 22:51:29 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkgdb.c,v 1.35 2009/09/11 18:00:13 joerg Exp $ */
+/*     $NetBSD: pkgdb.c,v 1.36 2009/10/22 22:51:29 joerg Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: pkgdb.c,v 1.35 2009/09/11 18:00:13 joerg Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.36 2009/10/22 22:51:29 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -78,7 +78,6 @@
 
 static DB   *pkgdbp;
 static char *pkgdb_dir = NULL;
-static char  pkgdb_cache[MaxPathSize];
 
 /*
  *  Open the pkg-database
@@ -310,8 +309,13 @@
 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 *
diff -r 22a0e1ab8342 -r 9f8e5c90a236 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Thu Oct 22 22:31:26 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Thu Oct 22 22:51:29 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.141 2009/10/21 17:10:36 joerg Exp $      */
+/*     $NetBSD: version.h,v 1.142 2009/10/22 22:51:29 joerg Exp $      */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20091021"
+#define PKGTOOLS_VERSION "20091022"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index