Fix bug introduced in previous patch (44b60f0c
)
This fixes a bug introduced in a previous patch (Commit 44b60f0c: Make __sdidinit unused). Removed intitialization of __cleanup from __smakebuf_r(). All callers of __smakebuf_r() call __sinit() through the_CHECK_INIT macro, thus __cleanup is already initialized. This fix also allows _cleanup_r() to be made static. Changed its name to cleanup_stdio() and removed its declaration from local.h.
This commit is contained in:
parent
3e3ccfaee6
commit
a160ee29e5
|
@ -234,7 +234,7 @@ __sflush_r (struct _reent *ptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _STDIO_BSD_SEMANTICS
|
#ifdef _STDIO_BSD_SEMANTICS
|
||||||
/* Called from _cleanup_r. At exit time, we don't need file locking,
|
/* Called from cleanup_stdio(). At exit time, we don't need file locking,
|
||||||
and we don't want to move the underlying file pointer unless we're
|
and we don't want to move the underlying file pointer unless we're
|
||||||
writing. */
|
writing. */
|
||||||
int
|
int
|
||||||
|
|
|
@ -199,8 +199,8 @@ found:
|
||||||
* The name `_cleanup' is, alas, fairly well known outside stdio.
|
* The name `_cleanup' is, alas, fairly well known outside stdio.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
_cleanup_r (struct _reent *ptr)
|
cleanup_stdio (struct _reent *ptr)
|
||||||
{
|
{
|
||||||
int (*cleanup_func) (struct _reent *, FILE *);
|
int (*cleanup_func) (struct _reent *, FILE *);
|
||||||
#ifdef _STDIO_BSD_SEMANTICS
|
#ifdef _STDIO_BSD_SEMANTICS
|
||||||
|
@ -232,7 +232,7 @@ _cleanup_r (struct _reent *ptr)
|
||||||
void
|
void
|
||||||
_cleanup (void)
|
_cleanup (void)
|
||||||
{
|
{
|
||||||
_cleanup_r (_GLOBAL_REENT);
|
cleanup_stdio (_GLOBAL_REENT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ __sinit (struct _reent *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure we clean up on exit */
|
/* make sure we clean up on exit */
|
||||||
s->__cleanup = _cleanup_r; /* conservative */
|
s->__cleanup = cleanup_stdio; /* conservative */
|
||||||
|
|
||||||
s->__sglue._next = NULL;
|
s->__sglue._next = NULL;
|
||||||
#ifndef _REENT_SMALL
|
#ifndef _REENT_SMALL
|
||||||
|
|
|
@ -180,7 +180,6 @@ extern _fpos_t __sseek (struct _reent *, void *, _fpos_t, int);
|
||||||
extern int __sclose (struct _reent *, void *);
|
extern int __sclose (struct _reent *, void *);
|
||||||
extern int __stextmode (int);
|
extern int __stextmode (int);
|
||||||
extern void __sinit (struct _reent *);
|
extern void __sinit (struct _reent *);
|
||||||
extern void _cleanup_r (struct _reent *);
|
|
||||||
extern void __smakebuf_r (struct _reent *, FILE *);
|
extern void __smakebuf_r (struct _reent *, FILE *);
|
||||||
extern int __swhatbuf_r (struct _reent *, FILE *, size_t *, int *);
|
extern int __swhatbuf_r (struct _reent *, FILE *, size_t *, int *);
|
||||||
extern int _fwalk_reent (struct _reent *, int (*)(struct _reent *, FILE *));
|
extern int _fwalk_reent (struct _reent *, int (*)(struct _reent *, FILE *));
|
||||||
|
|
|
@ -61,7 +61,6 @@ __smakebuf_r (struct _reent *ptr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ptr->__cleanup = _cleanup_r;
|
|
||||||
fp->_flags |= __SMBF;
|
fp->_flags |= __SMBF;
|
||||||
fp->_bf._base = fp->_p = (unsigned char *) p;
|
fp->_bf._base = fp->_p = (unsigned char *) p;
|
||||||
fp->_bf._size = size;
|
fp->_bf._size = size;
|
||||||
|
|
Loading…
Reference in New Issue