This commit adds support for file systems that don't support lseek(.., SEEK_HOLE) and lseek(,,,, SEEK_DATA). It corrects a bug that was introduced in a previous pull request
https://github.com/djs55/ocaml-vhd/pull/34. See a discussion of the design there. The bug introduced there was:
#if defined(SEEK_HOLE)
c_ret = lseek(c_fd, c_ofs, SEEK_HOLE);
/* retry, if SEEK_HOLE not supported on this file system */
if (c_ret == -1 && errno == EINVAL)
c_ret = lseek(c_fd, c_ofs, SEEK_END); /* <<< HERE */
#else
/* Set the file pointer to the end of the file; pretend
there is no hole */
c_ret = lseek(c_fd, 0, SEEK_END);
#endif
The offset when calling lseek in the retry must be 0, not c_ofs - just like in the #else case.
This commit adds support for file systems that don't support lseek(.., SEEK_HOLE) and lseek(,,,, SEEK_DATA). It corrects a bug that was introduced in a previous pull request https://github.com/djs55/ocaml-vhd/pull/34. See a discussion of the design there. The bug introduced there was:
The offset when calling
lseek
in the retry must be0
, notc_ofs
- just like in the#else
case.