summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2015-04-11 14:35:50 +1000
committerJames Ross-Gowan <rossymiles@gmail.com>2015-04-11 14:35:50 +1000
commit96d0a3f56c4427fdc5c52a4ee7dae540c6f2537e (patch)
tree4dd437b577e84037cc09ed4caa794d7194ae9832 /player
parent1e3aad5f876b8e01dd3100e1bc6ecd6572f2f9bf (diff)
downloadmpv-96d0a3f56c4427fdc5c52a4ee7dae540c6f2537e.tar.bz2
mpv-96d0a3f56c4427fdc5c52a4ee7dae540c6f2537e.tar.xz
main-fn-win: fix handle validity check for XP
Apparently the standard handles can be set to bogus values on XP. Use GetFileType to check whether they refer to an actual file/pipe/etc. The logic used by is_valid_handle() is now pretty similar to what the CRT uses to check for valid stdio handles.
Diffstat (limited to 'player')
-rw-r--r--player/main-fn-win.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/player/main-fn-win.c b/player/main-fn-win.c
index ad883dcba9..28fc5b3c24 100644
--- a/player/main-fn-win.c
+++ b/player/main-fn-win.c
@@ -14,7 +14,8 @@ int _dowildcard = 0;
static bool is_valid_handle(HANDLE h)
{
- return h != INVALID_HANDLE_VALUE && h != NULL;
+ return h != INVALID_HANDLE_VALUE && h != NULL &&
+ GetFileType(h) != FILE_TYPE_UNKNOWN;
}
static bool has_redirected_stdio(void)