Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Windows: avoid uv_guess_handle crash in when fd < 0
Browse files Browse the repository at this point in the history
Happens only when using a debug version of the crt.
  • Loading branch information
piscisaureus committed Mar 8, 2012
1 parent 1ac71a3 commit f43f1a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/win/handle.c
Expand Up @@ -27,9 +27,15 @@


uv_handle_type uv_guess_handle(uv_file file) {
HANDLE handle = (HANDLE) _get_osfhandle(file);
HANDLE handle;
DWORD mode;

if (file < 0) {
return UV_UNKNOWN_HANDLE;
}

handle = (HANDLE) _get_osfhandle(file);

switch (GetFileType(handle)) {
case FILE_TYPE_CHAR:
if (GetConsoleMode(handle, &mode)) {
Expand Down

0 comments on commit f43f1a7

Please sign in to comment.