about summary refs log tree commit diff
path: root/libio/oldfileops.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-09-04 20:10:35 +0000
committerUlrich Drepper <drepper@redhat.com>2005-09-04 20:10:35 +0000
commit34c5e4a1f1de2e755311855c1b15d1f35a1bd61f (patch)
treecbc269d34a1496450decab9563c1fcd087b98f03 /libio/oldfileops.c
parentf2cd432663701ce4d346b7b3232ad74e98c90aab (diff)
downloadglibc-34c5e4a1f1de2e755311855c1b15d1f35a1bd61f.tar.gz
glibc-34c5e4a1f1de2e755311855c1b15d1f35a1bd61f.tar.xz
glibc-34c5e4a1f1de2e755311855c1b15d1f35a1bd61f.zip
* stdio-common/Makefile (tests): Add tst-put-error.
	* stdio-common/tst-put-error.c: New file.
	* libio/fileops.c (_IO_new_file_xsputn): If overflow fails and no more
	data would have to be written signal error.
	* libio/oldfileops.c (_IO_old_file_xsputn): Likewise.

	* libio/fileops.c (_IO_new_file_overflow): Use NULL not 0.
Diffstat (limited to 'libio/oldfileops.c')
-rw-r--r--libio/oldfileops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index b9efca7aa8..2dd618215b 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.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>.
 
@@ -752,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 n - to_do;
+	return to_do == 0 ? 0 : n - to_do;
 
       /* Try to maintain alignment: write a whole number of blocks.
 	 dont_write is what gets left over. */