diff options
Diffstat (limited to 'libio/iofwrite.c')
-rw-r--r-- | libio/iofwrite.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libio/iofwrite.c b/libio/iofwrite.c index d163d29361..886de7ae35 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU IO Library. This library is free software; you can redistribute it and/or @@ -33,7 +33,7 @@ _IO_fwrite (buf, size, count, fp) _IO_FILE *fp; { _IO_size_t request = size * count; - _IO_size_t written; + _IO_size_t written = 0; CHECK_FILE (fp, 0); /* Many traditional implementations return 0 if size==0 && count > 0, but ANSI requires us to return count in this case. */ @@ -41,7 +41,8 @@ _IO_fwrite (buf, size, count, fp) return count; _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); - written = _IO_sputn (fp, (const char *) buf, request); + if (_IO_fwide (fp, -1) == -1) + written = _IO_sputn (fp, (const char *) buf, request); _IO_funlockfile (fp); _IO_cleanup_region_end (0); if (written == request) |