- /* first, use buffer */
- min = h->have - h->pos;
- if (min > 0)
- {
- if (min > len - pos)
- min = len - pos;
- memcpy (&dst[pos], &h->buffer[h->pos], min);
- h->pos += min;
- pos += min;
- }
- if (pos == len)
- return GNUNET_OK; /* done! */
- GNUNET_assert (h->have == h->pos);
- /* fill buffer */
- ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size);
- if (ret == -1)
- {
- GNUNET_asprintf (&h->emsg,
- _("Error reading `%s': %s"),
- what, STRERROR (errno));
- return GNUNET_SYSERR;
- }
- if (ret == 0)
- {
- GNUNET_asprintf (&h->emsg,
- _("Error reading `%s': %s"),
- what, _("End of file"));
- return GNUNET_SYSERR;
- }
- h->pos = 0;
- h->have = ret;
+ GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what,
+ _("End of file"));
+ return GNUNET_SYSERR;