Extra needs to be initialized for our usual pool of FILEs. This was

causing some versions of as to dump core.  This survived make
buildworld/installworld and the building gettext port afterwards.

Submitted by: <nnd@mail.nsk.ru> "N.Dudorov"
Reviewed by: "Daniel M. Eischen" <eischen@vigrid.com>
This commit is contained in:
Warner Losh 2001-02-16 21:09:49 +00:00
parent 93caaaa74b
commit b0f8f42120

View File

@ -66,6 +66,7 @@ int __sdidinit;
/* _ub _extra */
/* the usual - (stdin + stdout + stderr) */
static FILE usual[FOPEN_MAX - 3];
static struct __sFILEX usual_extra[FOPEN_MAX - 3];
static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
static struct __sFILEX __sFX[3];
@ -215,7 +216,17 @@ _cleanup()
void
__sinit()
{
/* Make sure we clean up on exit. */
__cleanup = _cleanup; /* conservative */
__sdidinit = 1;
int i;
THREAD_LOCK();
if (__sdidinit == 0) {
/* Set _extra for the usual suspects. */
for (i = 0; i < FOPEN_MAX - 3; i++)
usual[i]._extra = &usual_extra[i];
/* Make sure we clean up on exit. */
__cleanup = _cleanup; /* conservative */
__sdidinit = 1;
}
THREAD_UNLOCK();
}