csomh / rpms / rsync

Forked from rpms/rsync 3 years ago
Clone

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

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