DF-3257 / df3257.c
/* DF-3257: cd9660_ioctl catch-all ENOTTY hides FIOSEEKDATA/FIOSEEKHOLE: * lseek(SEEK_DATA) fails EINVAL on cd9660 while ufs/ext2 dispatch. */ #include <stdio.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char **argv) { int fd = open(argv[1], O_RDONLY); if (fd < 0) { perror("open"); return 1; } off_t r = lseek(fd, 0, SEEK_DATA); printf("lseek(%s, 0, SEEK_DATA) = %lld errno=%d\n", argv[1], (long long)r, errno); off_t h = lseek(fd, 0, SEEK_HOLE); printf("lseek(%s, 0, SEEK_HOLE) = %lld errno=%d\n", argv[1], (long long)h, errno); close(fd); return (r < 0) ? 2 : 0; /* EINVAL == the gap demonstrated */ } |