]> sourceware.org Git - newlib-cygwin.git/commitdiff
Revert "errno: Stop using _impure_ptr->_errno completely"
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 19 Jul 2017 08:28:39 +0000 (10:28 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 19 Jul 2017 08:28:39 +0000 (10:28 +0200)
This reverts commit 44b1746a41921533d27aca414a9188314cb725b6.

Bad idea.  _impure_ptr->_errno is used by newlib

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/cygerrno.h
winsup/cygwin/environ.cc
winsup/cygwin/errno.cc

index 05de6ab0d318e0082a8df88d77d00a1151959680..ce33d971a3e06d410024a2b850be45fbc61595cb 100644 (file)
@@ -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;
index 10ffd689c520b64e5c028af82a1b14afc36fdbf2..647db5fe3f3769fa64f10806dae65e073953c172 100644 (file)
@@ -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
     {
index 390723e670f7433bf4e213521128970f04bf8d81..9168e9b4d965abf3e85b2015e879947096b9bbbd 100644 (file)
@@ -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 *
This page took 0.035766 seconds and 5 git commands to generate.