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.
This commit is contained in:
parent
2a97634017
commit
3d1452b99c
2 changed files with 12 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_ */
|
||||
|
|
Loading…
Reference in a new issue