From dffe3016d3c3e91f2c07826c8d69ca5a0e6f4944 Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 19 Aug 1999 07:17:35 +0000 Subject: [PATCH] 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. --- usr.sbin/pkg_install/add/perform.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index d4fa5453b3d9..957ecafb72b8 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -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 #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 @@ -271,10 +271,12 @@ pkg_do(char *pkg) char installed[FILENAME_MAX]; char *s; - if ((s=strrchr(PkgName, '-')) != NULL){ - strcpy(buf, PkgName); - buf[s-PkgName+1]='*'; - buf[s-PkgName+2]='\0'; + if ((s = strrchr(PkgName, '-')) != NULL){ + 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);