diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 14:44:28 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 14:44:28 +0300 |
commit | ba763344d4116912e616337f7a8c305a29c48c36 (patch) | |
tree | 90eb315c815042ca7c32696b9cc013cdd4b29e00 /rpmdb/db3.c | |
parent | bd9e4ed8d7dec6ab7a247298fa8ce5be67e98f58 (diff) | |
download | rpm-ba763344d4116912e616337f7a8c305a29c48c36.tar.gz rpm-ba763344d4116912e616337f7a8c305a29c48c36.tar.bz2 rpm-ba763344d4116912e616337f7a8c305a29c48c36.zip |
Use rpmGetPath() to construct full dbpath in db3open()
- another alloca() bites the dust...
Diffstat (limited to 'rpmdb/db3.c')
-rw-r--r-- | rpmdb/db3.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/rpmdb/db3.c b/rpmdb/db3.c index 9727d0eea..fe2e0c5de 100644 --- a/rpmdb/db3.c +++ b/rpmdb/db3.c @@ -1065,24 +1065,16 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) } if (rc == 0) { - const char * dbfullpath; + char * fullpath; const char * dbpath; - char * t; - int nb; + fullpath = rpmGetPath(dbhome, "/", dbfile ? dbfile : "", NULL); - nb = strlen(dbhome); - if (dbfile) nb += 1 + strlen(dbfile); - dbfullpath = t = alloca(nb + 1); - - t = stpcpy(t, dbhome); - if (dbfile) - t = stpcpy( stpcpy( t, "/"), dbfile); #ifdef HACK /* XXX necessary to support dbsubfile */ dbpath = (!dbi->dbi_use_dbenv && !dbi->dbi_temporary) - ? dbfullpath : dbfile; + ? fullpath : dbfile; #else dbpath = (!dbi->dbi_temporary) - ? dbfullpath : dbfile; + ? fullpath : dbfile; #endif rc = (db->open)(db, txnid, dbpath, dbsubfile, @@ -1094,6 +1086,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) if (xx == 0) dbi->dbi_type = dbi_type; } + free(fullpath); } /* XXX return rc == errno without printing */ |