1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00
This commit is contained in:
Jakub Jelinek
2007-07-12 18:26:36 +00:00
parent 7d58530341
commit 0ecb606cb6
6215 changed files with 494638 additions and 305010 deletions

View File

@@ -1,4 +1,5 @@
/* Copyright (C) 1993, 1995, 1997-2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1997-2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -271,7 +272,7 @@ _IO_old_file_setbuf (fp, p, len)
return fp;
}
static int old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW;
static int old_do_write (_IO_FILE *, const char *, _IO_size_t);
/* Write TO_DO bytes from DATA to FP.
Then mark FP as having empty buffers. */
@@ -695,7 +696,7 @@ _IO_old_file_xsputn (f, data, n)
register const char *s = (char *) data;
_IO_size_t to_do = n;
int must_flush = 0;
_IO_size_t count;
_IO_size_t count = 0;
if (n <= 0)
return 0;
@@ -704,7 +705,6 @@ _IO_old_file_xsputn (f, data, n)
(or the filebuf is unbuffered), use sys_write directly. */
/* First figure out how much space is available in the buffer. */
count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */
if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
{
count = f->_IO_buf_end - f->_IO_write_ptr;
@@ -722,6 +722,9 @@ _IO_old_file_xsputn (f, data, n)
}
}
}
else if (f->_IO_write_end > f->_IO_write_ptr)
count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */
/* Then fill the buffer. */
if (count > 0)
{
@@ -752,7 +755,7 @@ _IO_old_file_xsputn (f, data, n)
_IO_size_t block_size, do_write;
/* Next flush the (full) buffer. */
if (__overflow (f, EOF) == EOF)
return n - to_do;
return to_do == 0 ? EOF : n - to_do;
/* Try to maintain alignment: write a whole number of blocks.
dont_write is what gets left over. */