Commit Diff


commit - 3ba86cef03fa638e9139444ade6c2fa86bde5df8
commit + 500467ff1bf0dbd15c0941dd741e80c35c708818
blob - e9a814c992d4c6755b06762f4d3e2ad3ca23f46e
blob + 212005d9592126ec098f1b8aa4bc9d16f95910b0
--- got/got.c
+++ got/got.c
@@ -2410,7 +2410,7 @@ blame_cb(void *arg, int nlines, int lineno, struct got
 		char *smallerthan, *at, *nl, *committer;
 		size_t len;
 
-		if (getline(&line, &linesize, a->f) == (ssize_t)-1) {
+		if (getline(&line, &linesize, a->f) == -1) {
 			if (ferror(a->f))
 				err = got_error_from_errno("getline");
 			break;
blob - 87c3a41fdf7c2a7070b2f62589f9f824d1576e95
blob + 7f642f79a8a65d6108f7c2155e573bb5a5fe4e9a
--- lib/diff3.c
+++ lib/diff3.c
@@ -655,7 +655,8 @@ static char *
 get_line(FILE *b, size_t *n, struct diff3_state *d3s)
 {
 	char *cp = NULL;
-	size_t size, len;
+	size_t size;
+	ssize_t len;
 	char *new;
 	char *ret = NULL;
 
blob - c6ccac6b2920245c609ec5aade63beea6bca9342
blob + 729abd35f59472f4970e7b7f254344f6af2e1b79
--- lib/worktree.c
+++ lib/worktree.c
@@ -2864,9 +2864,12 @@ skip_one_line(FILE *f)
 	ssize_t linelen;
 
 	linelen = getline(&line, &linesize, f);
+	if (linelen == -1) {
+		if (ferror(f))
+			return got_error_from_errno("getline");
+		return NULL;
+	}
 	free(line);
-	if (linelen == -1 && ferror(f))
-		return got_error_from_errno("getline");
 	return NULL;
 }