diff options
author | Christopher Faylor <me@cgf.cx> | 2002-01-06 17:29:41 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-01-06 17:29:41 +0000 |
commit | 10dedaaa4c128cf40419e8a42418ed8a223b9a70 (patch) | |
tree | 9adfc142cb0fec006bf88e830d1dc95630bec8f3 | |
parent | d7e7027d128595fe671c3ce175cdb07e5c69906b (diff) | |
download | cygnal-10dedaaa4c128cf40419e8a42418ed8a223b9a70.tar.gz cygnal-10dedaaa4c128cf40419e8a42418ed8a223b9a70.tar.bz2 cygnal-10dedaaa4c128cf40419e8a42418ed8a223b9a70.zip |
* dtable.cc (dtable::init_std_file_from_handle): Add some defensive code to
invalid handle case.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 091c256b4..de4e329c2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-01-06 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (dtable::init_std_file_from_handle): Add some defensive + code to invalid handle case. + 2002-01-06 Corinna Vinschen <corinna@vinschen.de> * ioctl.cc (ioctl): Make third argument optional. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index a6f5b075c..e7e9fd252 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -91,8 +91,8 @@ dtable::extend (int howmuch) } /* Initialize the file descriptor/handle mapping table. - We only initialize the parent table here. The child table is - initialized at each fork () call. */ + This function should only be called when a cygwin function is invoked + by a non-cygwin function, i.e., it should only happen very rarely. */ void stdio_init (void) @@ -197,7 +197,10 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess) first_fd_for_open = 0; if (!handle || handle == INVALID_HANDLE_VALUE) - return; + { + fds[fd] = NULL; + return; + } if (__fmode) bin = __fmode; |