diff options
| author | jlam <jlam@NetBSD.org> | 2003-09-08 06:41:23 +0000 |
|---|---|---|
| committer | jlam <jlam@NetBSD.org> | 2003-09-08 06:41:23 +0000 |
| commit | 140fe23a05ca652b72cf93da4acdbd3b8fd7908a (patch) | |
| tree | 35005a8ac1267f2331c20e336c83034dbabf13bf /usr.sbin/pkg_install/lib | |
| parent | a7155b99517af4497004326cd02670f506bdf708 (diff) | |
strlen(pkgname) only returns the number of characters preceding the NUL,
but the size of the data field in the pkgdb.byfile.db file is the length of
the string plus 1 for the NUL. Fix this check so that removing all of the
files belonging to pkgname from pkgdb.byfile.db works again.
Diffstat (limited to 'usr.sbin/pkg_install/lib')
| -rw-r--r-- | usr.sbin/pkg_install/lib/pkgdb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/lib/pkgdb.c b/usr.sbin/pkg_install/lib/pkgdb.c index 5399669824c..de11ecf5f8f 100644 --- a/usr.sbin/pkg_install/lib/pkgdb.c +++ b/usr.sbin/pkg_install/lib/pkgdb.c @@ -1,8 +1,8 @@ -/* $NetBSD: pkgdb.c,v 1.16 2003/09/08 05:34:35 jlam Exp $ */ +/* $NetBSD: pkgdb.c,v 1.17 2003/09/08 06:41:23 jlam Exp $ */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: pkgdb.c,v 1.16 2003/09/08 05:34:35 jlam Exp $"); +__RCSID("$NetBSD: pkgdb.c,v 1.17 2003/09/08 06:41:23 jlam Exp $"); #endif /* @@ -217,7 +217,7 @@ pkgdb_remove_pkg(const char *pkg) } cc = strlen(pkg); for (ret = 1, type = R_FIRST; (*pkgdbp->seq)(pkgdbp, &key, &data, type) == 0 ; type = R_NEXT) { - if (cc == data.size && strncmp(data.data, pkg, cc) == 0) { + if ((cc + 1) == data.size && strncmp(data.data, pkg, cc) == 0) { if (Verbose) { printf("Removing file %s from pkgdb\n", (char *)key.data); } |
