summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/rpmcache.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/rpmcache.c b/tools/rpmcache.c
index 9d372ad68..fd25b83a9 100644
--- a/tools/rpmcache.c
+++ b/tools/rpmcache.c
@@ -443,24 +443,20 @@ static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmts ts)
*/
static void initGlobs(rpmts ts, const char ** argv)
{
- char buf[BUFSIZ];
+ char *buf = NULL;
int i;
- buf[0] = '\0';
if (argv != NULL && * argv != NULL) {
const char * arg;
int single = (glob_pattern_p(argv[0], 0) && argv[1] == NULL);
- char * t;
- t = buf;
- if (!single)
- t = stpcpy(t, "@(");
+ if (!single) {
+ rstrcat(&buf, "@(");
+ }
while ((arg = *argv++) != NULL) {
- t = stpcpy(t, arg);
- *t++ = '|';
+ rstrscat(&buf, arg, "|", NULL);
}
- t[-1] = (single ? '\0' : ')');
- *t = '\0';
+ buf[strlen(buf)-1] = single ? '\0' : ')';
}
bhpath = rpmExpand("%{_bhpath}", NULL);
@@ -509,6 +505,7 @@ static void initGlobs(rpmts ts, const char ** argv)
rpmlog(RPMLOG_DEBUG, "\t%d \"%s\"\n",
i, bhglobs[i].patterns[0]);
}
+ free(buf);
}
static rpmVSFlags vsflags = 0;