12745e
diff --git glibc-2.17-c758a686/libio/wfileops.c glibc-2.17-c758a686/libio/wfileops.c
2e9afc
index 87d3cdc..877fc1f 100644
12745e
--- glibc-2.17-c758a686/libio/wfileops.c
12745e
+++ glibc-2.17-c758a686/libio/wfileops.c
2e9afc
@@ -715,7 +715,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
2e9afc
 		       - fp->_wide_data->_IO_write_base) / clen;
2e9afc
 	  else
2e9afc
 	    {
2e9afc
-	      enum __codecvt_result status;
2e9afc
+	      enum __codecvt_result status = __codecvt_ok;
2e9afc
 	      delta = (fp->_wide_data->_IO_write_ptr
2e9afc
 		       - fp->_wide_data->_IO_write_base);
2e9afc
 	      const wchar_t *write_base = fp->_wide_data->_IO_write_base;
2e9afc
@@ -728,9 +728,12 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
2e9afc
 		 flush buffers for every ftell.  */
2e9afc
 	      do
2e9afc
 		{
2e9afc
-		  /* Ugh, no point trying to avoid the flush.  Just do it
2e9afc
-		     and go back to how it was with the read mode.  */
2e9afc
-		  if (delta > 0 && new_write_ptr == fp->_IO_buf_end)
2e9afc
+		  /* There is not enough space in the buffer to do the entire
2e9afc
+		     conversion, so there is no point trying to avoid the
2e9afc
+		     buffer flush.  Just do it and go back to how it was with
2e9afc
+		     the read mode.  */
2e9afc
+		  if (status == __codecvt_partial
2e9afc
+		      || (delta > 0 && new_write_ptr == fp->_IO_buf_end))
2e9afc
 		    {
2e9afc
 		      if (_IO_switch_to_wget_mode (fp))
2e9afc
 			return WEOF;