summaryrefslogtreecommitdiff
path: root/ACE/ace/OS_NS_unistd.inl
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2009-06-04 08:55:32 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2009-06-04 08:55:32 +0000
commit84a41c26dfc51f1807f970808c96595f0fbf78d7 (patch)
tree36098e69944beb49bf506bfad20bf79dee4c6f8b /ACE/ace/OS_NS_unistd.inl
parente47beac55114c450ad2e2681c0ac940a20eb928f (diff)
downloadATCD-84a41c26dfc51f1807f970808c96595f0fbf78d7.tar.gz
Thu Jun 4 08:56:05 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/OS_NS_unistd.inl (isatty): Check the return value of _open_osfhandle, if it returns -1, it failed and then calling _isatty with -1 will cause an assert of the msvc9 runtime
Diffstat (limited to 'ACE/ace/OS_NS_unistd.inl')
-rw-r--r--ACE/ace/OS_NS_unistd.inl8
1 files changed, 6 insertions, 2 deletions
diff --git a/ACE/ace/OS_NS_unistd.inl b/ACE/ace/OS_NS_unistd.inl
index 9765a0ece92..414cb40688b 100644
--- a/ACE/ace/OS_NS_unistd.inl
+++ b/ACE/ace/OS_NS_unistd.inl
@@ -623,8 +623,12 @@ ACE_OS::isatty (ACE_HANDLE handle)
return 0;
#else
int const fd = ::_open_osfhandle (intptr_t (handle), 0);
- int const status = ::_isatty (fd);
- ::_close (fd);
+ int status = 0;
+ if (fd != -1)
+ {
+ status = ::_isatty (fd);
+ ::_close (fd);
+ }
return status;
#endif /* ACE_LACKS_ISATTY */
}