- fd = open(file, (flags&F_FIX) ? O_RDWR : O_RDONLY);
- if (fd < 0)
- { gripe_syserr(2, errno, "failed to open `%s'", file); goto end; }
- if (fstat(fd, &st)) {
- gripe_syserr(2, errno, "failed to retrieve file status for `%s'", file);
- goto end;
- }
- if (st.st_size%SECTORSZ) {
+ open_dvd(file, (flags&F_FIX) ? O_RDWR : O_RDONLY, &fd, 0);
+ blksz = SECTORSZ; volsz = device_size(fd, file, &blksz);
+ if (SECTORSZ != 2048)
+ { gripe(2, "device sector size %d /= 2048", blksz); goto end; }
+ if (volsz%SECTORSZ) {