diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-09-12 07:10:59 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-09-12 07:10:59 +0000 |
commit | 5e6e144e096c83beefb5bd50ea22da7266e72aee (patch) | |
tree | 80b4ba2f5794225b6f0dbee4171394423dc82cf2 /libio | |
parent | 753ea4414a6a5994cf156d9a11582d18a1fb2a6f (diff) | |
download | glibc-5e6e144e096c83beefb5bd50ea22da7266e72aee.tar.gz |
Updated to fedora-glibc-20050912T0656
Diffstat (limited to 'libio')
-rw-r--r-- | libio/fileops.c | 10 | ||||
-rw-r--r-- | libio/oldfileops.c | 4 | ||||
-rw-r--r-- | libio/stdio.h | 20 |
3 files changed, 18 insertions, 16 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. */ 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. */ diff --git a/libio/stdio.h b/libio/stdio.h index ac42b3e2ac..4c1fe287e3 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -401,7 +401,7 @@ extern int fscanf (FILE *__restrict __stream, extern int scanf (__const char *__restrict __format, ...) __wur; /* Read formatted input from S. */ extern int sscanf (__const char *__restrict __s, - __const char *__restrict __format, ...) __THROW __wur; + __const char *__restrict __format, ...) __THROW; __END_NAMESPACE_STD #ifdef __USE_ISOC99 @@ -424,7 +424,7 @@ extern int vscanf (__const char *__restrict __format, _G_va_list __arg) /* Read formatted input from S into argument list ARG. */ extern int vsscanf (__const char *__restrict __s, __const char *__restrict __format, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; + __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); __END_NAMESPACE_C99 #endif /* Use ISO C9x. */ @@ -596,7 +596,7 @@ extern int puts (__const char *__s); This function is a possible cancellation points and therefore not marked with __THROW. */ -extern int ungetc (int __c, FILE *__stream) __wur; +extern int ungetc (int __c, FILE *__stream); /* Read chunks of generic data from STREAM. @@ -722,16 +722,16 @@ __BEGIN_NAMESPACE_STD /* Clear the error and EOF indicators for STREAM. */ extern void clearerr (FILE *__stream) __THROW; /* Return the EOF indicator for STREAM. */ -extern int feof (FILE *__stream) __THROW; +extern int feof (FILE *__stream) __THROW __wur; /* Return the error indicator for STREAM. */ -extern int ferror (FILE *__stream) __THROW; +extern int ferror (FILE *__stream) __THROW __wur; __END_NAMESPACE_STD #ifdef __USE_MISC /* Faster versions when locking is not required. */ extern void clearerr_unlocked (FILE *__stream) __THROW; -extern int feof_unlocked (FILE *__stream) __THROW; -extern int ferror_unlocked (FILE *__stream) __THROW; +extern int feof_unlocked (FILE *__stream) __THROW __wur; +extern int ferror_unlocked (FILE *__stream) __THROW __wur; #endif @@ -752,12 +752,12 @@ __END_NAMESPACE_STD #ifdef __USE_POSIX /* Return the system file descriptor for STREAM. */ -extern int fileno (FILE *__stream) __THROW; +extern int fileno (FILE *__stream) __THROW __wur; #endif /* Use POSIX. */ #ifdef __USE_MISC /* Faster version when locking is not required. */ -extern int fileno_unlocked (FILE *__stream) __THROW; +extern int fileno_unlocked (FILE *__stream) __THROW __wur; #endif @@ -767,7 +767,7 @@ extern int fileno_unlocked (FILE *__stream) __THROW; This function is a possible cancellation point and therefore not marked with __THROW. */ -extern FILE *popen (__const char *__command, __const char *__modes); +extern FILE *popen (__const char *__command, __const char *__modes) __wur; /* Close a stream opened by popen and return the status of its child. |