From 0f4db8cbe03453c0715aff20b074816d455847b4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 16 Oct 2001 03:31:50 +0000 Subject: * 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. --- winsup/cygwin/cygheap.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/cygheap.h') 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; -- cgit v1.2.3