A bit of sanity checking in rpmtsRebuildDB()
- Don't permit rebuilddb on populated transaction as rebuild can and usually does change header instance numbering.
This commit is contained in:
parent
4a3d7f2c73
commit
626e78429f
23
lib/rpmts.c
23
lib/rpmts.c
|
@ -125,14 +125,21 @@ int rpmtsSetDBMode(rpmts ts, int dbmode)
|
|||
|
||||
int rpmtsRebuildDB(rpmts ts)
|
||||
{
|
||||
int rc;
|
||||
rpmlock lock = rpmtsAcquireLock(ts);
|
||||
if (!lock) return -1;
|
||||
if (!(ts->vsflags & RPMVSF_NOHDRCHK))
|
||||
rc = rpmdbRebuild(ts->rootDir, ts, headerCheck);
|
||||
else
|
||||
rc = rpmdbRebuild(ts->rootDir, NULL, NULL);
|
||||
rpmlockFree(lock);
|
||||
int rc = -1;
|
||||
rpmlock lock = NULL;
|
||||
|
||||
/* Cannot do this on a populated transaction set */
|
||||
if (rpmtsNElements(ts) > 0)
|
||||
return -1;
|
||||
|
||||
lock = rpmtsAcquireLock(ts);
|
||||
if (lock) {
|
||||
if (!(ts->vsflags & RPMVSF_NOHDRCHK))
|
||||
rc = rpmdbRebuild(ts->rootDir, ts, headerCheck);
|
||||
else
|
||||
rc = rpmdbRebuild(ts->rootDir, NULL, NULL);
|
||||
rpmlockFree(lock);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue