summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygheap.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-10-16 03:31:50 +0000
committerChristopher Faylor <me@cgf.cx>2001-10-16 03:31:50 +0000
commit0f4db8cbe03453c0715aff20b074816d455847b4 (patch)
treef25bad6474738ae7b1eb8f60b4b7497c66e5855c /winsup/cygwin/cygheap.h
parentdf63bd490a526af2d68f391f703abe8b54a502db (diff)
downloadcygnal-0f4db8cbe03453c0715aff20b074816d455847b4.tar.gz
cygnal-0f4db8cbe03453c0715aff20b074816d455847b4.tar.bz2
cygnal-0f4db8cbe03453c0715aff20b074816d455847b4.zip
* cygerrno.h (set_errno): Define more informative version of this function for
debugging. (__set_errno): Declare when DEBUGGING. * cygheap.h (cygheap_fdget::cygheap_fdget): Add a flag to control when errno is set. * debug.cc (__set_errno): New function. * fcntl.cc (_fcntl): Fix so that correct fd is used for second argument to dup2. * syscalls.cc (_cygwin_istext_for_stdio): Don't set errno here when using cygheap_fdget.
Diffstat (limited to 'winsup/cygwin/cygheap.h')
-rw-r--r--winsup/cygwin/cygheap.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index f018517fe..5fb4b8ecd 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -228,7 +228,7 @@ class cygheap_fdnew : public cygheap_fdmanip
class cygheap_fdget : public cygheap_fdmanip
{
public:
- cygheap_fdget (int fd, bool lockit = false)
+ cygheap_fdget (int fd, bool lockit = false, bool do_set_errno = true)
{
if (lockit)
SetResourceLock (LOCK_FD_LIST, READ_LOCK, "cygheap_fdget");
@@ -241,7 +241,8 @@ class cygheap_fdget : public cygheap_fdmanip
else
{
this->fd = -1;
- set_errno (EBADF);
+ if (do_set_errno)
+ set_errno (EBADF + 1);
if (lockit)
ReleaseResourceLock (LOCK_FD_LIST, READ_LOCK, "cygheap_fdget");
locked = false;