Commit abc6a33f6abdb9b7560fe12f4d32a2f7471ed81c

Stefan Sperling 2019-02-08T13:20:08

make readin() actually write to its output argument

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/diff3.c b/lib/diff3.c
index f0f0493..bd1d37e 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -563,6 +563,8 @@ readin(size_t *n, char *name, struct diff **dd, struct diff3_state *d3s)
 	char kind, *p;
 	size_t i;
 
+	*n = 0;
+
 	d3s->fp[0] = fopen(name, "r");
 	if (d3s->fp[0] == NULL)
 		return got_error_from_errno();
@@ -602,6 +604,7 @@ readin(size_t *n, char *name, struct diff **dd, struct diff3_state *d3s)
 
 	(void)fclose(d3s->fp[0]);
 
+	*n = i;
 	return NULL;
 }