It seems that Fread returns the number of bytes read, as opposed
to the number of items, each size bytes long.  The relevant comment
in rpmio.h says that Fread is "fread(3) clone" (which implies that
the number of items should be returned).

This breaks the following idiomatic code which used to work with rpm-4.0:
    char buf[110];
    if (Fread(buf, 110, 1, cpio->fd) != 1)
        die("%s: cannot read cpio header", cpio->rpmbname);
The program dies with "cannot read cpio header", while in fact Fread
returns 110.  It seems that the only way to reconcile the number of
bytes and the number of items is to require that size be 1.  Indeed,
I would much prefer an assertion failure.

This change breaks the existing code which calls Fread with nmemb=1
and expects the number of bytes to be returned.
You can view, comment on, or merge this pull request online at:

-- Commit Summary --

  * rpmio.c: In Fread(buf,size,nmemb,FD), require size be 1

-- File Changes --

    M rpmio/rpmio.c (9)

-- Patch Links --

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
Rpm-maint mailing list

Reply via email to