diff options
author | joerg <joerg> | 2009-10-22 22:51:29 +0000 |
---|---|---|
committer | joerg <joerg> | 2009-10-22 22:51:29 +0000 |
commit | 4dca26e2e547c5668d010e785457d644f47ff1d5 (patch) | |
tree | f91b06a0037ac5b1322badfb58e04300a122ea1e /pkgtools/pkg_install | |
parent | 227d11d4b8f611d3b8ce580a02ac4e2600e310f8 (diff) | |
download | pkgsrc-4dca26e2e547c5668d010e785457d644f47ff1d5.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.c | 14 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
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_ */ |