aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index c3f2a2c9cb..127d883a04 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4986,7 +4986,10 @@ e_write (desc, string, start, end, coding)
break;
}
}
- if (result == CODING_FINISH_INSUFFICIENT_SRC)
+ nbytes -= coding->consumed;
+ addr += coding->consumed;
+ if (result == CODING_FINISH_INSUFFICIENT_SRC
+ && nbytes > 0)
{
/* The source text ends by an incomplete multibyte form.
There's no way other than write it out as is. */
@@ -4999,8 +5002,6 @@ e_write (desc, string, start, end, coding)
}
if (nbytes <= 0)
break;
- nbytes -= coding->consumed;
- addr += coding->consumed;
start += coding->consumed_char;
if (coding->cmp_data)
coding_adjust_composition_offset (coding, start);