summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg>2009-10-22 22:51:29 +0000
committerjoerg <joerg>2009-10-22 22:51:29 +0000
commit2cdb8d4807c996d596ca6b18713c2e1191a463c6 (patch)
treef91b06a0037ac5b1322badfb58e04300a122ea1e /pkgtools/pkg_install
parent10754f084eb6494084a91391bafed0dfe10507aa (diff)
downloadpkgsrc-2cdb8d4807c996d596ca6b18713c2e1191a463c6.tar.gz
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 (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c14
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 11 insertions, 7 deletions
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 1026e5a721f..a72664d542a 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -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 @@ __RCSID("$NetBSD: pkgdb.c,v 1.35 2009/09/11 18:00:13 joerg Exp $");
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 *
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 74a5f423a40..30c18a3b189 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -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_ */