[Rpm-maint] [rpm-software-management/rpm] How to change a header value of something in the base and in the package file itself? (#478)
Victor Polevoy
notifications at github.com
Wed Aug 1 13:16:19 UTC 2018
@n3npq Could you tell me please, what am I doing wrong here?
```c
static int readPackage(const char *packageFileName)
{
int ret = 0;
const FD_t fd = Fopen(packageFileName, "r+.ufdio");
if (fd == NULL || Ferror(fd)) {
fprintf(stderr, _("%s: open failed: %s\n"), packageFileName, Fstrerror(fd));
ret = 1;
goto exit;
}
/* Read rpm lead */
char *msg = NULL;
if (rpmLeadRead(fd, NULL, &msg) != RPMRC_OK) {
fprintf(stderr, _("Unable to read rpm lead from %s: %s\n"), packageFileName, msg);
ret = 2;
goto exit;
}
struct hdrblob_s sigblob;
if (hdrblobRead(fd, 1, 0, RPMTAG_HEADERSIGNATURES, &sigblob, &msg)) {
fprintf(stderr, _("Could not read signature header from %s: %s\n"), packageFileName, msg);
ret = 3;
goto exit;
}
struct hdrblob_s blob;
if (hdrblobRead(fd, 1, 1, RPMTAG_HEADERIMMUTABLE, &blob, &msg)) {
fprintf(stderr, _("Could not read header from %s: %s\n"), packageFileName, msg);
ret = 5;
goto exit;
}
Header sigh = NULL;
if (hdrblobImport(&sigblob, 0, &sigh, &msg)) {
fprintf(stderr, _("Could not parse signature header from %s: %s\n"), packageFileName, msg);
ret = 4;
goto exit;
}
Header h = NULL;
if (hdrblobImport(&blob, 0, &h, &msg)) {
fprintf(stderr, _("Could not parse header from %s: %s\n"), packageFileName, msg);
ret = 6;
goto exit;
}
if (!sigh || !h) {
fprintf(stderr, "Pointers are null.\n");
ret = 7;
goto exit;
}
unloadImmutableRegion(h, RPMTAG_HEADERIMMUTABLE);
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/478#issuecomment-409570753
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180801/9a6dc3ef/attachment.html>
More information about the Rpm-maint
mailing list