From 870d41ca67dc81b09aef04df3a1055a8e53475d0 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 18 Feb 2009 13:27:18 +0000 Subject: merge revision(s) 20540: * win32/win32.c (rb_w32_isatty): check whether fd is valid. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@22416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ version.h | 2 +- win32/win32.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eac1565bd..91be64de8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Feb 18 22:27:11 2009 NAKAMURA Usaku + + * win32/win32.c (rb_w32_isatty): check whether fd is valid. + Wed Feb 18 22:23:44 2009 NAKAMURA Usaku * win32/win32.c (waitpid): fix bug of checking child slot. diff --git a/version.h b/version.h index 699bfc952..2a3d4584a 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-02-18" #define RUBY_VERSION_CODE 186 #define RUBY_RELEASE_CODE 20090218 -#define RUBY_PATCHLEVEL 340 +#define RUBY_PATCHLEVEL 341 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 diff --git a/win32/win32.c b/win32/win32.c index 5fd467838..91b4ea89b 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3911,6 +3911,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; -- cgit