ls-files: Don't require exclude files to end with a newline.
Without this patch, the last line of an exclude file is silently ignored if it doesn't end with a newline. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Alexandre Julliard committed
Mar 18, 2006 at 11:27 UTC
451d7b47f1ba380b4f8e32b28052fff06eeb8638
1 file changed
+2
-1
ls-files.c
+2
-1
@@ -92,11 +92,12 @@ static int add_excludes_from_file_1(const char *fname,
92
close(fd);
93
return 0;
94
}
95
- buf = xmalloc(size);
95
+ buf = xmalloc(size+1);
96
if (read(fd, buf, size) != size)
97
goto err;
98
close(fd);
99
100
+ buf[size++] = '\n';
101
entry = buf;
102
for (i = 0; i < size; i++) {
103
if (buf[i] == '\n') {