summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-07-20 08:49:18 +0000
committerUlrich Drepper <drepper@redhat.com>2008-07-20 08:49:18 +0000
commit9f558b80513ba1314671ccc90620285a8eea6990 (patch)
tree9388ece154177941a23d6517f5c7ec277003a9b3 /stdio-common
parent2486b4965bc9cad848f2da57fe0ea53f851bd5ad (diff)
downloadglibc-9f558b80513ba1314671ccc90620285a8eea6990.tar.gz
glibc-9f558b80513ba1314671ccc90620285a8eea6990.tar.xz
glibc-9f558b80513ba1314671ccc90620285a8eea6990.zip
* locale/setlocale.c (setlocale): Take the setlocale lock earlier.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/vfprintf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 78a1c77d8a..714c76c3d4 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -2080,8 +2080,11 @@ _IO_helper_overflow (_IO_FILE *s, int c)
     {
       _IO_size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base,
 				      used);
-      if (written == 0)
+      if (written == 0 || written == WEOF)
 	return WEOF;
+      __wmemmove (s->_wide_data->_IO_write_base,
+		  s->_wide_data->_IO_write_base + written,
+		  used - written);
       s->_wide_data->_IO_write_ptr -= written;
     }
 #else
@@ -2089,8 +2092,10 @@ _IO_helper_overflow (_IO_FILE *s, int c)
   if (used)
     {
       _IO_size_t written = _IO_sputn (target, s->_IO_write_base, used);
-      if (written == 0)
+      if (written == 0 || written == EOF)
 	return EOF;
+      memmove (s->_IO_write_base, s->_IO_write_base + written,
+	       used - written);
       s->_IO_write_ptr -= written;
     }
 #endif