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

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