diff options
Diffstat (limited to 'rerere.c')
-rw-r--r-- | rerere.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -125,13 +125,20 @@ static void rerere_io_putconflict(int ch, int size, struct rerere_io *io) char buf[64]; while (size) { - if (size < sizeof(buf) - 2) { + if (size <= sizeof(buf) - 2) { memset(buf, ch, size); buf[size] = '\n'; buf[size + 1] = '\0'; size = 0; } else { int sz = sizeof(buf) - 1; + + /* + * Make sure we will not write everything out + * in this round by leaving at least 1 byte + * for the next round, giving the next round + * a chance to add the terminating LF. Yuck. + */ if (size <= sz) sz -= (sz - size) + 1; memset(buf, ch, sz); |