aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/wsetup.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/wsetup.c')
-rw-r--r--newlib/libc/stdio/wsetup.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c
index ba98813..dcbda0a 100644
--- a/newlib/libc/stdio/wsetup.c
+++ b/newlib/libc/stdio/wsetup.c
@@ -1,7 +1,7 @@
/* No user fns here. Pesch 15apr92. */
/*
- * Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1990, 2007 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -29,7 +29,8 @@
*/
int
-_DEFUN(__swsetup, (fp),
+_DEFUN(__swsetup_r, (ptr, fp),
+ struct _reent *ptr _AND
register FILE * fp)
{
/* Make sure stdio is set up. */
@@ -48,7 +49,7 @@ _DEFUN(__swsetup, (fp),
{
/* clobber any ungetc data */
if (HASUB (fp))
- FREEUB (fp);
+ FREEUB (ptr, fp);
fp->_flags &= ~(__SRD | __SEOF);
fp->_r = 0;
fp->_p = fp->_bf._base;
@@ -63,7 +64,7 @@ _DEFUN(__swsetup, (fp),
*/
if (fp->_bf._base == NULL
&& (!(fp->_flags & __SSTR) || (fp->_flags & __SMBF)))
- __smakebuf (fp);
+ __smakebuf_r (ptr, fp);
if (fp->_flags & __SLBF)
{
@@ -78,5 +79,5 @@ _DEFUN(__swsetup, (fp),
else
fp->_w = fp->_flags & __SNBF ? 0 : fp->_bf._size;
- return 0;
+ return (!fp->_bf._base && (fp->_flags & __SMBF)) ? EOF : 0;
}