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