2004-05-27 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/vfprintf.c (_VFPRINTF): Move file locking from here ... (_VFPRINTF_R): ... to here so all I/O printf routines are covered.
This commit is contained in:
parent
6d70519a4b
commit
3f611058b7
@ -1,3 +1,10 @@
|
|||||||
|
2004-05-27 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* libc/stdio/vfprintf.c (_VFPRINTF): Move file locking
|
||||||
|
from here ...
|
||||||
|
(_VFPRINTF_R): ... to here so all I/O printf routines
|
||||||
|
are covered.
|
||||||
|
|
||||||
2004-05-26 Jeff Johnston <jjohnstn@redhat.com>
|
2004-05-26 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libc/search/hash_buf.c: Protect MAX and MIN macros from
|
* libc/search/hash_buf.c: Protect MAX and MIN macros from
|
||||||
|
@ -381,10 +381,7 @@ _DEFUN(VFPRINTF, (fp, fmt0, ap),
|
|||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
_flockfile (fp);
|
|
||||||
CHECK_INIT (fp);
|
|
||||||
result = _VFPRINTF_R (_REENT, fp, fmt0, ap);
|
result = _VFPRINTF_R (_REENT, fp, fmt0, ap);
|
||||||
_funlockfile (fp);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,14 +533,21 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
|
|||||||
(u_long)GET_ARG (N, ap, u_int))
|
(u_long)GET_ARG (N, ap, u_int))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_flockfile (fp);
|
||||||
|
CHECK_INIT (fp);
|
||||||
|
|
||||||
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
|
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
|
||||||
if (cantwrite (fp))
|
if (cantwrite (fp)) {
|
||||||
|
_funlockfile (fp);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
|
}
|
||||||
|
|
||||||
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
|
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
|
||||||
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
|
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
|
||||||
fp->_file >= 0)
|
fp->_file >= 0) {
|
||||||
|
_funlockfile (fp);
|
||||||
return (__sbprintf (data, fp, fmt0, ap));
|
return (__sbprintf (data, fp, fmt0, ap));
|
||||||
|
}
|
||||||
|
|
||||||
fmt = (char *)fmt0;
|
fmt = (char *)fmt0;
|
||||||
uio.uio_iov = iovp = iov;
|
uio.uio_iov = iovp = iov;
|
||||||
@ -1211,6 +1215,7 @@ done:
|
|||||||
error:
|
error:
|
||||||
if (malloc_buf != NULL)
|
if (malloc_buf != NULL)
|
||||||
_free_r (data, malloc_buf);
|
_free_r (data, malloc_buf);
|
||||||
|
_funlockfile (fp);
|
||||||
return (__sferror (fp) ? EOF : ret);
|
return (__sferror (fp) ? EOF : ret);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user