diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 13:28:06 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 13:28:06 +0000 |
commit | 440fec216c712076701ef81c126c96e09c5a1325 (patch) | |
tree | b9dbb1bb98384be27effc5c006d8335fb8089145 /win32 | |
parent | 9d8bb15c5c9f090b28322cde172b1321ea893e22 (diff) |
merge revision(s) 20540:
* win32/win32.c (rb_w32_isatty): check whether fd is valid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index abe3949600..944ff3a931 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4088,6 +4088,10 @@ rb_w32_unlink(const char *path) int rb_w32_isatty(int fd) { + // validate fd by using _get_osfhandle() because we cannot access _nhandle + if (_get_osfhandle(fd) == -1) { + return 0; + } if (!(_osfile(fd) & FOPEN)) { errno = EBADF; return 0; |