[PATCH] Do not drop data from '\0' until eol in patch output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The binary file detection is just a heuristic which can well fail.
Do not produce garbage patches in these cases.

Signed-off-by: Stephan Feder <sf@xxxxxxxx>
---
 diff.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 507e401..f0450a8 100644
--- a/diff.c
+++ b/diff.c
@@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, c
 	}
 	if (len > 0 && line[len-1] == '\n')
 		len--;
-	printf("%s%.*s%s\n", set, (int) len, line, reset);
+	fputs (set, stdout);
+	fwrite (line, len, 1, stdout);
+	puts (reset);
 }
 
 static char *pprint_rename(const char *a, const char *b)
-- 
1.4.1.gbc483

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]