This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Use _REENT_INIT to initialize the reent structure of newlib.
- To: cygwin-patches at cygwin dot com
- Subject: Use _REENT_INIT to initialize the reent structure of newlib.
- From: Kazuhiro Fujieda <fujieda at jaist dot ac dot jp>
- Date: 27 Apr 2001 05:27:56 +0900
- Reply-To: cygwin-patches at cygwin dot com
The thread_init_wrapper doesn't properly initialize the reent
structure of newlib. It has some non-zero fields other than
_stdin, _stdout, and _stderr.
2001-04-27 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize
the reent structure of newlib.
Index: thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.28
diff -u -p -r1.28 thread.cc
--- thread.cc 2001/04/23 02:56:19 1.28
+++ thread.cc 2001/04/26 20:20:00
@@ -737,7 +737,7 @@ thread_init_wrapper (void *_arg)
pthread *thread = (pthread *) _arg;
struct __reent_t local_reent;
struct _winsup_t local_winsup;
- struct _reent local_clib;
+ struct _reent local_clib = _REENT_INIT(local_clib);
struct sigaction _sigs[NSIG];
sigset_t _sig_mask; /* one set for everything to ignore. */
@@ -748,13 +748,7 @@ thread_init_wrapper (void *_arg)
thread->sigmask = &_sig_mask;
thread->sigtodo = _sigtodo;
- memset (&local_clib, 0, sizeof (struct _reent));
memset (&local_winsup, 0, sizeof (struct _winsup_t));
-
- local_clib._errno = 0;
- local_clib._stdin = &local_clib.__sf[0];
- local_clib._stdout = &local_clib.__sf[1];
- local_clib._stderr = &local_clib.__sf[2];
local_reent._clib = &local_clib;
local_reent._winsup = &local_winsup;
____
| AIST Kazuhiro Fujieda <fujieda@jaist.ac.jp>
| HOKURIKU School of Information Science
o_/ 1990 Japan Advanced Institute of Science and Technology