* 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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user