summaryrefslogtreecommitdiff
path: root/rpmdb/dbconfig.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-08 17:10:10 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-08 17:10:10 +0300
commit6a8ddd9bc22cd8bf7d5100da9915cdae91549a3b (patch)
tree13b29f8b0fa8587b9f0d0ee2c3428a15a0551690 /rpmdb/dbconfig.c
parentaa3ab021a8b7c633ddacca71adc1b86038bff3ff (diff)
downloadrpm-6a8ddd9bc22cd8bf7d5100da9915cdae91549a3b.tar.gz
Eliminate static print buffer from prDbiOpenFlags()
- unlikely to actually overflow but it'd be all the more embarrasing as it's just diagnostics/debug code...
Diffstat (limited to 'rpmdb/dbconfig.c')
-rw-r--r--rpmdb/dbconfig.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index 02748ed2a..fc75af3bf 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -10,6 +10,7 @@
#include <rpm/rpmmacro.h>
#include <rpm/rpmstring.h>
#include <rpm/rpmlog.h>
+#include <rpm/argv.h>
#include "rpmdb/rpmdb_internal.h"
#include "debug.h"
@@ -434,14 +435,12 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
return dbi;
}
-const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
+char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
{
- static char buf[256];
+ ARGV_t flags = NULL;
struct poptOption *opt;
- char * oe;
+ char *buf;
- oe = buf;
- *oe = '\0';
for (opt = rdbOptions; opt->longName != NULL; opt++) {
if (opt->argInfo != POPT_BIT_SET)
continue;
@@ -456,16 +455,18 @@ const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
}
if ((dbflags & opt->val) != opt->val)
continue;
- if (oe != buf)
- *oe++ = ':';
- oe = stpcpy(oe, opt->longName);
+ argvAdd(&flags, opt->longName);
dbflags &= ~opt->val;
}
if (dbflags) {
- if (oe != buf)
- *oe++ = ':';
- sprintf(oe, "0x%x", (unsigned)dbflags);
+ char *df = NULL;
+ rasprintf(&df, "0x%x", (unsigned)dbflags);
+ argvAdd(&flags, df);
+ free(df);
}
+ buf = argvJoin(flags, ":");
+ argvFree(flags);
+
return buf;
}