Modify conflict check to avoid matching packages with the same name prefix

(e.g. "teTeX" and "teTeX-share"). Patch is based on a suggestion by
Hubert Feyrer, fixes PR pkg/8219.
This commit is contained in:
tron 1999-08-19 07:17:35 +00:00
parent f33ac29caa
commit dffe3016d3
1 changed files with 8 additions and 6 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.31 1999/06/15 06:32:00 cgd Exp $ */
/* $NetBSD: perform.c,v 1.32 1999/08/19 07:17:35 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.31 1999/06/15 06:32:00 cgd Exp $");
__RCSID("$NetBSD: perform.c,v 1.32 1999/08/19 07:17:35 tron Exp $");
#endif
#endif
@ -272,9 +272,11 @@ pkg_do(char *pkg)
char *s;
if ((s = strrchr(PkgName, '-')) != NULL){
strcpy(buf, PkgName);
buf[s-PkgName+1]='*';
buf[s-PkgName+2]='\0';
int l;
l = s-PkgName+1;
memcpy(buf, PkgName, l);
strcpy(&buf[l],"[0-9]*");
if (findmatchingname(dbdir, buf, check_if_installed, installed) > 0) {
warnx("other version '%s' already installed", installed);