Blame SOURCES/rsync-3.0.6-iconv-logging.patch

d3382b
diff --git a/log.c b/log.c
d3382b
index 34a013b..1aca728 100644
d3382b
--- a/log.c
d3382b
+++ b/log.c
d3382b
@@ -377,10 +377,13 @@ output_msg:
d3382b
 				filtered_fwrite(f, convbuf, outbuf.len, 0);
d3382b
 				outbuf.len = 0;
d3382b
 			}
d3382b
-			if (!ierrno || ierrno == E2BIG)
d3382b
-				continue;
d3382b
-			fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));
d3382b
-			inbuf.len--;
d3382b
+			/* Log one byte of illegal/incomplete sequence and continue with
d3382b
+			 * the next character. Check that the buffer is non-empty for the
d3382b
+			 * sake of robustness. */
d3382b
+			if ((ierrno == EILSEQ || ierrno == EINVAL) && inbuf.len) {
d3382b
+				fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));
d3382b
+				inbuf.len--;
d3382b
+			}
d3382b
 		}
d3382b
 	} else
d3382b
 #endif