}
#endif /* HAVE_LIBZ */
- lseek(fp->fd, 0, SEEK_SET);
+ if (lseek(fp->fd, 0, SEEK_SET))
+ {
+ DEBUG_printf(("cupsFileRewind: lseek failed: %s\n", strerror(errno)));
+ return (-1);
+ }
fp->bufpos = 0;
fp->pos = 0;
cupsFileTell(cups_file_t *fp) /* I - CUPS file */
{
DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
- DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST (fp ? fp->pos : -1)));
return (fp ? fp->pos : 0);
}
fp->ptr, fp->end, fp->buf, CUPS_LLCAST fp->bufpos, fp->eof));
if (fp->ptr && fp->end)
- fp->bufpos += fp->end - fp->ptr;
+ fp->bufpos += fp->end - fp->buf;
#ifdef HAVE_LIBZ
DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
fp->ptr = fp->buf;
fp->end = fp->buf + bytes;
- DEBUG_printf((" returning " CUPS_LLFMT "!\n", CUPS_LLCAST bytes));
+ DEBUG_printf(("cups_fill: Returning " CUPS_LLFMT "!\n",
+ CUPS_LLCAST bytes));
return (bytes);
}