From 3bbe7a7fc4111c050eb21eeb9867a17ba46d9796 Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 11 Jul 2001 00:07:46 +0000 Subject: [PATCH] - unlink all __db.nnn files before 1st db open. CVS patchset: 4932 CVS date: 2001/07/11 00:07:46 --- CHANGES | 1 + rpmdb/rpmdb.c | 13 +++++++++++++ rpmqv.c | 2 -- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4fa24ba..e595c5c 100644 --- a/CHANGES +++ b/CHANGES @@ -158,6 +158,7 @@ - package version now configureable, default v3. - rename rpm libraries to have version with libtool -release. - fix: -i CLI context broken Yet Again. + - unlink all __db.nnn files before 1st db open. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index c73fa4e..5903d1d 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -869,6 +869,19 @@ static int openDatabase(/*@null@*/ const char * prefix, int minimal = flags & RPMDB_FLAG_MINIMAL; if (!_initialized || dbiTagsMax == 0) { + char * filename; + int i; + + i = sizeof("//__db.000"); + if (prefix) i += strlen(prefix); + if (dbpath) i += strlen(dbpath); + filename = alloca(i); + for (i = 0; i < 16; i++) { + sprintf(filename, "%s/%s/__db.%03d", + (prefix ? prefix : ""), (dbpath ? dbpath : ""), i); + (void) rpmCleanPath(filename); + (void) unlink(filename); + } dbiTagsInit(); _initialized++; } diff --git a/rpmqv.c b/rpmqv.c index 8384ce2..d016807 100755 --- a/rpmqv.c +++ b/rpmqv.c @@ -510,7 +510,6 @@ int main(int argc, const char ** argv) } #ifdef IAM_RPMBT - if (bigMode == MODE_UNKNOWN) { switch (ba->buildMode) { case 'b': bigMode = MODE_BUILD; break; case 't': bigMode = MODE_TARBUILD; break; @@ -528,7 +527,6 @@ int main(int argc, const char ** argv) bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) { argerror("--buildroot may only be used during package builds"); } - } #endif /* IAM_RPMBT */ #ifdef IAM_RPMDB -- 2.7.4