summary refs log tree commit diff
path: root/iconv/iconv_prog.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/iconv_prog.c')
-rw-r--r--iconv/iconv_prog.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index c91c76f34f..cd00bbfce7 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -320,6 +320,8 @@ process_block (iconv_t cd, const char *addr, size_t len, FILE *output)
       if (outptr != outbuf)
 	{
 	  /* We have something to write out.  */
+	  int errno_save = errno;
+
 	  if (fwrite (outbuf, 1, outptr - outbuf, output) < outptr - outbuf
 	      || ferror (output))
 	    {
@@ -328,6 +330,8 @@ process_block (iconv_t cd, const char *addr, size_t len, FILE *output)
 conversion stopped due to problem in writing the output"));
 	      return -1;
 	    }
+
+	  errno = errno_save;
 	}
 
       if (n != (size_t) -1)