summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2017-07-19 10:28:39 +0200
committerCorinna Vinschen <corinna@vinschen.de>2017-07-19 10:28:39 +0200
commit78ade082fef08900ad104628061f57aaa4c1eb8e (patch)
tree78e40366a4f0c43e3cd7f1beec712bfb604ca8f8
parentbb12a1e587b07d3730f631a63fb2a46f811f867d (diff)
downloadcygnal-78ade082fef08900ad104628061f57aaa4c1eb8e.tar.gz
cygnal-78ade082fef08900ad104628061f57aaa4c1eb8e.tar.bz2
cygnal-78ade082fef08900ad104628061f57aaa4c1eb8e.zip
Revert "errno: Stop using _impure_ptr->_errno completely"
This reverts commit 44b1746a41921533d27aca414a9188314cb725b6. Bad idea. _impure_ptr->_errno is used by newlib Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/cygerrno.h4
-rw-r--r--winsup/cygwin/environ.cc3
-rw-r--r--winsup/cygwin/errno.cc4
3 files changed, 6 insertions, 5 deletions
diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
index 05de6ab0d..ce33d971a 100644
--- a/winsup/cygwin/cygerrno.h
+++ b/winsup/cygwin/cygerrno.h
@@ -30,7 +30,7 @@ extern inline int
__set_errno (const char *fn, int ln, int val)
{
debug_printf ("%s:%d setting errno %d", fn, ln, val);
- return errno = val;
+ return errno = _impure_ptr->_errno = val;
}
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
@@ -45,7 +45,7 @@ class save_errno
save_errno (int what) {saved = get_errno (); set_errno (what); }
void set (int what) {set_errno (what); saved = what;}
void reset () {saved = get_errno ();}
- ~save_errno () {errno = saved;}
+ ~save_errno () {errno = _impure_ptr->_errno = saved;}
};
extern const char *__sp_fn;
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 10ffd689c..647db5fe3 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -454,7 +454,8 @@ posify_maybe (char **here, const char *value, char *outenv)
memcpy (outenv, src, len);
char *newvalue = outenv + len;
- if (!conv->toposix (value, newvalue, NT_MAX_PATH - len) || errno != EIDRM)
+ if (!conv->toposix (value, newvalue, NT_MAX_PATH - len)
+ || _impure_ptr->_errno != EIDRM)
conv->add_cache (newvalue, *value != '/' ? value : NULL);
else
{
diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc
index 390723e67..9168e9b4d 100644
--- a/winsup/cygwin/errno.cc
+++ b/winsup/cygwin/errno.cc
@@ -339,7 +339,7 @@ void __reg3
seterrno_from_win_error (const char *file, int line, DWORD code)
{
syscall_printf ("%s:%d windows error %u", file, line, code);
- errno = geterrno_from_win_error (code, EACCES);
+ errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES);
}
int __reg2
@@ -357,7 +357,7 @@ seterrno_from_nt_status (const char *file, int line, NTSTATUS status)
SetLastError (code);
syscall_printf ("%s:%d status %y -> windows error %u",
file, line, status, code);
- errno = geterrno_from_win_error (code, EACCES);
+ errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES);
}
static char *