diff options
author | rillig <rillig@pkgsrc.org> | 2007-09-11 12:33:13 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-09-11 12:33:13 +0000 |
commit | e3b68da0ff0fe543fcdd40478c1a41c124b5b121 (patch) | |
tree | 9efeb17f6771423ff82896e301575e28d260affb /pkgtools | |
parent | 02182710b5fbe9901b5d06567d56695d0bf00191 (diff) | |
download | pkgsrc-e3b68da0ff0fe543fcdd40478c1a41c124b5b121.tar.gz |
Applying sizeof() to a string parameter does not return the size of the
buffer, but the size of a pointer to a buffer. This makes pkg_add -u
work again. It failed before, trying to rename the +REQUIRED_BY file to
"/us" or "/va", depending on the value of PKGDBDIR.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/files/add/perform.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index 649649ec231..d630be9f7c9 100644 --- a/pkgtools/pkg_install/files/add/perform.c +++ b/pkgtools/pkg_install/files/add/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.61 2007/09/08 09:58:14 rillig Exp $ */ +/* $NetBSD: perform.c,v 1.62 2007/09/11 12:33:13 rillig Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -14,7 +14,7 @@ #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.61 2007/09/08 09:58:14 rillig Exp $"); +__RCSID("$NetBSD: perform.c,v 1.62 2007/09/11 12:33:13 rillig Exp $"); #endif #endif @@ -212,6 +212,9 @@ pkg_do_installed(int *replacing, char replace_via[MaxPathSize], char replace_to[ char buf[MaxPathSize]; char *best_installed; + const size_t replace_via_size = MaxPathSize; + const size_t replace_to_size = MaxPathSize; + if ((s = strrchr(PkgName, '-')) == NULL) { warnx("Package name %s does not contain a version, bailing out", PkgName); return -1; @@ -241,9 +244,9 @@ pkg_do_installed(int *replacing, char replace_via[MaxPathSize], char replace_to[ /* XXX Should list the steps in Fake mode */ snprintf(replace_from, sizeof(replace_from), "%s/%s/" REQUIRED_BY_FNAME, dbdir, best_installed); - snprintf(replace_via, sizeof(replace_via), "%s/.%s." REQUIRED_BY_FNAME, + snprintf(replace_via, replace_via_size, "%s/.%s." REQUIRED_BY_FNAME, dbdir, best_installed); - snprintf(replace_to, sizeof(replace_to), "%s/%s/" REQUIRED_BY_FNAME, + snprintf(replace_to, replace_to_size, "%s/%s/" REQUIRED_BY_FNAME, dbdir, PkgName); if (Verbose) |