Add test for in-file seeking for data; it should return the passed offset.

This commit is contained in:
reinoud 2006-09-21 22:09:20 +00:00
parent 7e62a1bf65
commit e2c2b53a9f

View File

@ -99,6 +99,19 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
printf( "if seek_data in the middle of a non-sparse file returns "
"the current position\n");
cur = lseek(fd, st.st_size-50, SEEK_DATA);
if (cur != st.st_size - 50) {
printf("Seek data didn't give passed seek position back\n");
return EXIT_FAILURE;
}
if (errno != ENXIO) {
printf( "Seek data on the end of file didn't"
" raise ENXIO\n");
return EXIT_FAILURE;
}
printf("seeking for hole\n");
cur = lseek(fd, 0, SEEK_HOLE);
if (cur != st.st_size) {