Skip to content

Commit 16ef3ee

Browse files
pmatilaiffesti
authored andcommitted
Refactor lower level keystore delete to separate function
Paving way for next steps, no functional changes.
1 parent a23edf0 commit 16ef3ee

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/rpmts.cc

+16-6
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,17 @@ rpmRC rpmtxnImportPubkey(rpmtxn txn, const unsigned char * pkt, size_t pktlen)
794794
return rc;
795795
}
796796

797+
static rpmRC rpmKeystoreDeletePubkey(rpmtxn txn, rpmPubkey key)
798+
{
799+
rpmRC rc = RPMRC_FAIL;
800+
rpmts ts = rpmtxnTs(txn);
801+
if (ts->keyringtype == KEYRING_FS)
802+
rc = rpmtsDeleteFSKey(txn, key);
803+
else
804+
rc = rpmtsDeleteDBKey(txn, key);
805+
return rc;
806+
}
807+
797808
rpmRC rpmtxnDeletePubkey(rpmtxn txn, rpmPubkey key)
798809
{
799810
rpmRC rc = RPMRC_FAIL;
@@ -807,13 +818,12 @@ rpmRC rpmtxnDeletePubkey(rpmtxn txn, rpmPubkey key)
807818
rpmtsSetVSFlags(ts, oflags);
808819

809820
/* Both import and delete just return OK on test-transaction */
810-
rc = RPMRC_OK;
811-
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
812-
if (ts->keyringtype == KEYRING_FS)
813-
rc = rpmtsDeleteFSKey(txn, key);
814-
else
815-
rc = rpmtsDeleteDBKey(txn, key);
821+
if ((rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
822+
rc = RPMRC_OK;
823+
} else {
824+
rc = rpmKeystoreDeletePubkey(txn, key);
816825
}
826+
rc = RPMRC_OK;
817827
rpmKeyringFree(keyring);
818828
}
819829
return rc;

0 commit comments

Comments
 (0)