mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 00:23:27 +00:00
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.
This commit is contained in:
parent
1e3aad5f87
commit
96d0a3f56c
@ -14,7 +14,8 @@ int _dowildcard = 0;
|
|||||||
|
|
||||||
static bool is_valid_handle(HANDLE h)
|
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)
|
static bool has_redirected_stdio(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user