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

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