if (magicp == HEADER_MAGIC_YES)
i += 2;
- /* FIX: cast? */
- if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
+ if (Fread(block, 1, i*sizeof(*block), fd) != i*sizeof(*block))
goto exit;
i = 0;
ei[1] = htonl(dl);
len -= sizeof(il) + sizeof(dl);
- /* FIX: cast? */
- if (timedRead(fd, (char *)&ei[2], len) != len)
+ if (Fread((char *)&ei[2], 1, len, fd) != len)
goto exit;
h = headerLoad(ei);
*msg = NULL;
memset(block, 0, sizeof(block));
- if ((xx = timedRead(fd, (char *)block, sizeof(block))) != sizeof(block)) {
+ if ((xx = Fread(block, 1, sizeof(block), fd)) != sizeof(block)) {
rasprintf(&buf,
_("hdr size(%d): BAD, read returned %d\n"), (int)sizeof(block), xx);
goto exit;
ei = xmalloc(uc);
ei[0] = block[2];
ei[1] = block[3];
- if ((xx = timedRead(fd, (char *)&ei[2], nb)) != nb) {
+ if ((xx = Fread((char *)&ei[2], 1, nb, fd)) != nb) {
rasprintf(&buf, _("hdr blob(%zd): BAD, read returned %d\n"), nb, xx);
goto exit;
}
{
assert(lead != NULL);
memset(lead, 0, sizeof(*lead));
- /* FIX: remove timed read */
- if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
+ if (Fread(lead, 1, sizeof(*lead), fd) != sizeof(*lead)) {
if (Ferror(fd)) {
rpmlog(RPMLOG_ERR, _("read failed: %s (%d)\n"),
Fstrerror(fd), errno);
goto exit;
memset(block, 0, sizeof(block));
- if ((xx = timedRead(fd, (void *)block, sizeof(block))) != sizeof(block)) {
+ if ((xx = Fread(block, 1, sizeof(block), fd)) != sizeof(block)) {
rasprintf(&buf, _("sigh size(%d): BAD, read returned %d\n"),
(int)sizeof(block), xx);
goto exit;
ei[1] = block[3];
pe = (entryInfo) &ei[2];
dataStart = (unsigned char *) (pe + il);
- if ((xx = timedRead(fd, (void *)pe, nb)) != nb) {
+ if ((xx = Fread(pe, 1, nb, fd)) != nb) {
rasprintf(&buf,
_("sigh blob(%d): BAD, read returned %d\n"), (int)nb, xx);
goto exit;
rpm_loff_t archSize = 0;
/* Position at beginning of header. */
- if (pad && (trc = timedRead(fd, (void *)block, pad)) != pad) {
+ if (pad && (trc = Fread(block, 1, pad, fd)) != pad) {
rasprintf(&buf,
_("sigh pad(%zd): BAD, read %zd bytes\n"), pad, trc);
goto exit;
ssize_t timedRead(FD_t fd, void * bufptr, size_t length)
{
- return ufdio->read(fd, bufptr, length);
+ return Fread(bufptr, 1, length, fd);
}
/* =============================================================== */
/**
* XXX the name is misleading, this is a legacy wrapper that ensures
* only S_ISREG() files are read, nothing to do with timed...
- * TODO: get this out of the API
+ * TODO: get this out of the API, should go out in the next soname bump
*/
ssize_t timedRead(FD_t fd, void * bufptr, size_t length);