p.z.l wrote:
Now, I don't get why
ssize_t pread (int fd, void *buf, size_t count, __int64 offset)
{
_lseeki64 (fd, offset, SEEK_SET);
return read (fd, buf, count);
}
or
ssize_t pread(int fd, void *buf, size_t count, long long offset)
{
(...)
ret = ReadFile(fh, buf, (DWORD)count, &bytes, &o);
(...)
}
would work as they don't preserve file pointer, and are not thread safe either.
I guess they don't work, and you have just been lucky until now. But
sooner or later the seek of one thread will be executed between the seek
and the read of another thread, and corrupt data will result.
Plzip needs a thread safe pread function to guarantee safe operation,
like the one defined by posix:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html
"The pread() function shall be equivalent to read(), except that it
shall read from a given position in the file without changing the file
offset."
Best regards,
Antonio.
_______________________________________________
Lzip-bug mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lzip-bug