43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
From a427c3cd2776bc523bd40491a5d92d98d071ffea Mon Sep 17 00:00:00 2001
|
|
From: Demi Marie Obenour <athena@invisiblethingslab.com>
|
|
Date: Tue, 16 Mar 2021 11:41:16 +0200
|
|
Subject: [PATCH] Optimize signature header merge a bit
|
|
|
|
Look up possible offending tags from the main header first in a separate
|
|
loop, this avoids having to re-sort after each headerPut() operation
|
|
---
|
|
lib/package.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/package.c b/lib/package.c
|
|
index 6f10bb9..355c3e7 100644
|
|
--- a/lib/package.c
|
|
+++ b/lib/package.c
|
|
@@ -64,10 +64,14 @@ rpmTagVal headerMergeLegacySigs(Header h, Header sigh, char **msg)
|
|
{
|
|
const struct taglate_s *xl;
|
|
struct rpmtd_s td;
|
|
- rpmtdReset(&td);
|
|
for (xl = xlateTags; xl->stag; xl++) {
|
|
/* There mustn't be one in the main header */
|
|
if (headerIsEntry(h, xl->xtag))
|
|
+ goto exit;
|
|
+ }
|
|
+
|
|
+ rpmtdReset(&td);
|
|
+ for (xl = xlateTags; xl->stag; xl++) {
|
|
if (headerGet(sigh, xl->stag, &td, HEADERGET_RAW|HEADERGET_MINMEM)) {
|
|
/* Translate legacy tags */
|
|
if (xl->stag != xl->xtag)
|
|
@@ -86,6 +90,7 @@ rpmTagVal headerMergeLegacySigs(Header h, Header sigh, char **msg)
|
|
}
|
|
rpmtdFreeData(&td);
|
|
|
|
+exit:
|
|
if (xl->stag) {
|
|
rasprintf(msg, "invalid signature tag %s (%d)",
|
|
rpmTagGetName(xl->xtag), xl->xtag);
|
|
--
|
|
2.27.0
|
|
|