summaryrefslogtreecommitdiff
path: root/libio/oldfileops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/oldfileops.c')
-rw-r--r--libio/oldfileops.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index 3bd0aa175b..b9efca7aa8 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2004, 2005, 2007
- Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997-2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -272,7 +271,7 @@ _IO_old_file_setbuf (fp, p, len)
return fp;
}
-static int old_do_write (_IO_FILE *, const char *, _IO_size_t);
+static int old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW;
/* Write TO_DO bytes from DATA to FP.
Then mark FP as having empty buffers. */
@@ -696,7 +695,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 = 0;
+ _IO_size_t count;
if (n <= 0)
return 0;
@@ -705,6 +704,7 @@ _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,9 +722,6 @@ _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)
{
@@ -755,7 +752,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 to_do == 0 ? EOF : n - to_do;
+ return n - to_do;
/* Try to maintain alignment: write a whole number of blocks.
dont_write is what gets left over. */