summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2018-04-25 12:20:53 +0000
committerjoerg <joerg@pkgsrc.org>2018-04-25 12:20:53 +0000
commit79aa86ab901cbbf3db1442f12e3866bec8a9e8ad (patch)
tree0256d1aedd417da573268b43cff578d3410619f4 /pkgtools/pkg_install
parenta32c031e87ba423dee3fc366ac5e02014c1d5d1d (diff)
downloadpkgsrc-79aa86ab901cbbf3db1442f12e3866bec8a9e8ad.tar.gz
pkg_install-20180425: correctly detect package names in PKG_DBDIR
If PKG_DBDIR is /foo and a path like /foobar is given, it is not below PKG_DBDIR, so don't translate it into a package name look up. The old logic for giving a path to PKG_DBDIR remains for legacy compat.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/info/main.c16
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 12 insertions, 8 deletions
diff --git a/pkgtools/pkg_install/files/info/main.c b/pkgtools/pkg_install/files/info/main.c
index 82b0e1d158b..6827443f07f 100644
--- a/pkgtools/pkg_install/files/info/main.c
+++ b/pkgtools/pkg_install/files/info/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.31 2012/12/17 04:34:02 agc Exp $ */
+/* $NetBSD: main.c,v 1.32 2018/04/25 12:20:53 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: main.c,v 1.31 2012/12/17 04:34:02 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.32 2018/04/25 12:20:53 joerg Exp $");
/*
*
@@ -299,12 +299,16 @@ main(int argc, char **argv)
errx(EXIT_FAILURE, "Error during search in pkgdb for %s", *argv);
}
} else {
- const char *dbdir;
+ const char *dbdir;
+ size_t dbdirlen;
dbdir = pkgdb_get_dir();
- if (**argv == '/' && strncmp(*argv, dbdir, strlen(dbdir)) == 0) {
- *argv += strlen(dbdir) + 1;
- if ((*argv)[strlen(*argv) - 1] == '/') {
+ dbdirlen = strlen(dbdir);
+ if (**argv == '/' &&
+ strncmp(*argv, dbdir, dbdirlen) == 0 &&
+ (*argv)[dbdirlen] == '/') {
+ *argv += dbdirlen + 1;
+ if (**argv && (*argv)[strlen(*argv) - 1] == '/') {
(*argv)[strlen(*argv) - 1] = 0;
}
}
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 16338d199f1..03501330653 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.175 2018/04/17 12:52:35 jperkin Exp $ */
+/* $NetBSD: version.h,v 1.176 2018/04/25 12:20:54 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 20180417
+#define PKGTOOLS_VERSION 20180425
#endif /* _INST_LIB_VERSION_H_ */