[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 07:42:40 UTC 2018
@n3npq Could you help me please?
```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, "PARASHA");
ret = 7;
goto exit;
}
// whenever I try to read any header value I receive (none) or (null) here, but pointers are not null (the check above ensure they are not)
}
```
--
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-409481522
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180801/7d54bcfd/attachment.html>
More information about the Rpm-maint
mailing list