Revert "stream: don't try to read from all-sparse/no-data files"

The stream layer is just not the right place to make this change
since it's also used for completely unrelated purposes such as reading
configs.

This reverts commit bb7a485c09.
This commit is contained in:
sfan5 2024-05-12 14:21:01 +02:00 committed by Kacper Michajłow
parent 21e167cc6a
commit a33fd3b4cf
2 changed files with 0 additions and 14 deletions

View File

@ -438,9 +438,6 @@ endif
features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE',
prefix: '#include <poll.h>')}
features += {'seek-data': cc.has_header_symbol('errno.h', 'ENXIO') and
cc.has_header_symbol('unistd.h', 'SEEK_DATA', args: '-D_GNU_SOURCE')}
cd_devices = {
'windows': 'D:',
'cygwin': 'D:',

View File

@ -358,17 +358,6 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
setmode(p->fd, O_BINARY);
#endif
#if HAVE_SEEK_DATA
if (stream->mode == STREAM_READ) {
off_t first_data = lseek(p->fd, 0, SEEK_DATA);
if (first_data == (off_t)-1 && errno == ENXIO) {
MP_ERR(stream, "File is empty or all sparse (has no data).\n");
s_close(stream);
return STREAM_ERROR;
}
}
#endif
off_t len = lseek(p->fd, 0, SEEK_END);
lseek(p->fd, 0, SEEK_SET);
if (len != (off_t)-1) {