mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-01-27 15:12:53 +01:00
Fix loading of last 1024 bytes for small PDF files (Issue #87)
This commit is contained in:
parent
3bc041e6d3
commit
026f653e07
@ -7,6 +7,7 @@ v1.4.1 - YYYY-MM-DD
|
||||
|
||||
- Fixed the link libraries for the example source code (Issue #86)
|
||||
- Fixed handling of the Info object (Issue #87)
|
||||
- Fixed opening of PDF files less than 1024 bytes in length (Issue #87)
|
||||
|
||||
|
||||
v1.4.0 - 2024-12-26
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Common support functions for pdfio.
|
||||
//
|
||||
// Copyright © 2021-2024 by Michael R Sweet.
|
||||
// Copyright © 2021-2025 by Michael R Sweet.
|
||||
//
|
||||
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||
// information.
|
||||
@ -398,7 +398,10 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
|
||||
}
|
||||
|
||||
// Seek within the file...
|
||||
if ((offset = lseek(pdf->fd, offset, whence)) < 0)
|
||||
if ((offset = lseek(pdf->fd, offset, whence)) < 0 && whence == SEEK_END && errno == EINVAL)
|
||||
offset = lseek(pdf->fd, 0, SEEK_SET);
|
||||
|
||||
if (offset < 0)
|
||||
{
|
||||
_pdfioFileError(pdf, "Unable to seek within file - %s", strerror(errno));
|
||||
return (-1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user