diff options
author | wm4 <wm4@nowhere> | 2014-10-17 21:37:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-17 21:43:18 +0200 |
commit | a7eb363ac1acb5566ce1af923d07c658361d5ad4 (patch) | |
tree | b085c3658dae7e76d8d306031e50fd2b75953ed0 /osdep/io.c | |
parent | 0abe9b0e0af03199fbc48b41ff38b0e0fa137cf2 (diff) | |
download | mpv-a7eb363ac1acb5566ce1af923d07c658361d5ad4.tar.bz2 mpv-a7eb363ac1acb5566ce1af923d07c658361d5ad4.tar.xz |
win32: make lseek() fail on pipes
On MingGW seeking on pipes succeeds.
This fix is quite similar to Gnulib's (lib/lseek.c).
Diffstat (limited to 'osdep/io.c')
-rw-r--r-- | osdep/io.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/osdep/io.c b/osdep/io.c index 819cdcbf69..b93618400c 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -17,6 +17,7 @@ * You should have received a copy of the GNU General Public License along * with mplayer2. If not, see <http://www.gnu.org/licenses/>. */ +#define MP_HIDE_IO_REPLACEMENTS #include <unistd.h> #include <errno.h> @@ -395,4 +396,14 @@ char *mp_getenv(const char *name) return NULL; } +off_t mp_lseek(int fd, off_t offset, int whence) +{ + HANDLE h = (HANDLE)_get_osfhandle(fd); + if (h != INVALID_HANDLE_VALUE && GetFileType(h) != FILE_TYPE_DISK) { + errno = ESPIPE; + return (off_t)-1; + } + return lseek(fd, offset, whence); +} + #endif // __MINGW32__ |