Skip to content

Commit

Permalink
Refactor signature insertion to a helper function
Browse files Browse the repository at this point in the history
No functional changes, just a tiny refactoring bit for the next steps.
  • Loading branch information
pmatilai committed Nov 11, 2024
1 parent 6de07ad commit a28bf89
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sign/rpmgensig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ static int haveSignature(rpmtd sigtd, Header h)
return rc;
}

static int putSignature(Header sigh, rpmtd sigtd)
{
return (headerPut(sigh, sigtd, HEADERPUT_DEFAULT) == 0);
}

static int replaceSignature(Header sigh, sigTarget sigt_v3, sigTarget sigt_v4)
{
int rc = -1;
Expand All @@ -420,7 +425,7 @@ static int replaceSignature(Header sigh, sigTarget sigt_v3, sigTarget sigt_v4)
/* Nuke all signature tags */
deleteSigs(sigh);

if (headerPut(sigh, sigtd, HEADERPUT_DEFAULT) == 0)
if (putSignature(sigh, sigtd))
goto exit;

if (sigt_v3) {
Expand All @@ -430,7 +435,7 @@ static int replaceSignature(Header sigh, sigTarget sigt_v3, sigTarget sigt_v4)
if ((sigtd = makeGPGSignature(0, sigt_v3)) == NULL)
goto exit;

if (headerPut(sigh, sigtd, HEADERPUT_DEFAULT) == 0)
if (putSignature(sigh, sigtd))
goto exit;
}

Expand Down

0 comments on commit a28bf89

Please sign in to comment.