mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_read, rb_w32_write, rb_w32_isatty): check
whether fd is valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
523d90905d
commit
862d56d5f9
2 changed files with 8 additions and 0 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Fri Dec 5 18:13:39 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_isatty): check whether fd is valid.
|
||||
|
||||
Fri Dec 5 12:49:24 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (waitpid): fix bug of checking child slot.
|
||||
|
|
|
|||
|
|
@ -4091,6 +4091,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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue