summaryrefslogtreecommitdiff
path: root/libio/fileops.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-09-12 07:10:59 +0000
committerJakub Jelinek <jakub@redhat.com>2005-09-12 07:10:59 +0000
commit5e6e144e096c83beefb5bd50ea22da7266e72aee (patch)
tree80b4ba2f5794225b6f0dbee4171394423dc82cf2 /libio/fileops.c
parent753ea4414a6a5994cf156d9a11582d18a1fb2a6f (diff)
Updated to fedora-glibc-20050912T0656
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 19151cf188..3ad9b74011 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997-2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -826,10 +826,10 @@ _IO_new_file_overflow (f, ch)
return EOF;
}
/* If currently reading or no buffer allocated. */
- if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == 0)
+ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == NULL)
{
/* Allocate a buffer if needed. */
- if (f->_IO_write_base == 0)
+ if (f->_IO_write_base == NULL)
{
INTUSE(_IO_doallocbuf) (f);
_IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
@@ -1338,7 +1338,9 @@ _IO_new_file_xsputn (f, data, n)
_IO_size_t block_size, do_write;
/* Next flush the (full) buffer. */
if (_IO_OVERFLOW (f, EOF) == EOF)
- return n - to_do;
+ /* If nothing else has to be written we must not signal the
+ caller that everything has been written. */
+ 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. */