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 bb7a485c0932375b888a61966970696c06851a15.
Unified · Split
| @@ -438,9 +438,6 @@ endif · 437 unmodified lines | |||
| 438 | features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE', | 438 | features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE', |
| 439 | prefix: '#include <poll.h>')} | 439 | prefix: '#include <poll.h>')} |
| 440 | 440 | ||
| 441 | features += {'seek-data': cc.has_header_symbol('errno.h', 'ENXIO') and | ||
| 442 | cc.has_header_symbol('unistd.h', 'SEEK_DATA', args: '-D_GNU_SOURCE')} | ||
| 443 | |||
| 444 | cd_devices = { | 441 | cd_devices = { |
| 445 | 'windows': 'D:', | 442 | 'windows': 'D:', |
| 446 | 'cygwin': 'D:', | 443 | 'cygwin': 'D:', |
| @@ -358,17 +358,6 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) · 357 unmodified lines | |||
| 358 | setmode(p->fd, O_BINARY); | 358 | setmode(p->fd, O_BINARY); |
| 359 | #endif | 359 | #endif |
| 360 | 360 | ||
| 361 | #if HAVE_SEEK_DATA | ||
| 362 | if (stream->mode == STREAM_READ) { | ||
| 363 | off_t first_data = lseek(p->fd, 0, SEEK_DATA); | ||
| 364 | if (first_data == (off_t)-1 && errno == ENXIO) { | ||
| 365 | MP_ERR(stream, "File is empty or all sparse (has no data).\n"); | ||
| 366 | s_close(stream); | ||
| 367 | return STREAM_ERROR; | ||
| 368 | } | ||
| 369 | } | ||
| 370 | #endif | ||
| 371 | |||
| 372 | off_t len = lseek(p->fd, 0, SEEK_END); | 361 | off_t len = lseek(p->fd, 0, SEEK_END); |
| 373 | lseek(p->fd, 0, SEEK_SET); | 362 | lseek(p->fd, 0, SEEK_SET); |
| 374 | if (len != (off_t)-1) { | 363 | if (len != (off_t)-1) { |