pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/add Applying sizeof() to a ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e8c529d1ca32
branches: trunk
changeset: 533214:e8c529d1ca32
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Sep 11 12:33:13 2007 +0000
description:
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:
pkgtools/pkg_install/files/add/perform.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r 3a8b5deca698 -r e8c529d1ca32 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c Tue Sep 11 11:19:13 2007 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c Tue Sep 11 12:33:13 2007 +0000
@@ -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 @@
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 @@
/* 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)
Home |
Main Index |
Thread Index |
Old Index