Commit d4592c7c7aa8a7bf2d09aeb096625941be8bd1e3

Stefan Sperling 2019-05-22T10:51:35

catch fopen(3) failure in collect_commit_logmsg()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/got/got.c b/got/got.c
index 3891b67..4670079 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2384,6 +2384,10 @@ collect_commit_logmsg(struct got_pathlist_head *commitable_paths, char **logmsg,
 	len = 0;
 
 	fp = fopen(a->logmsg_path, "r");
+	if (fp == NULL) {
+		err = got_error_from_errno("fopen");
+		goto done;
+	}
 	while (fgets(buf, sizeof(buf), fp) != NULL) {
 		if (!content_changed && strcmp(buf, initial_content) != 0)
 			content_changed = 1;