Commit Diff


commit - 596de3980450cf45f184c8d2efa1f98d424210fd
commit + 9fc8d6a2a532b47eaabf3cfd3faf77099cb7197e
blob - f3a09e4ad8f59d8af7ddee44566442c0bf640d57
blob + 2bfa94efc96d98d4217ff31fdc7f3eef4ff8b729
--- lib/diff.c
+++ lib/diff.c
@@ -529,12 +529,25 @@ got_diff_objects_as_commits(struct got_object *obj1, s
 	err = got_object_get_id_str(&id_str, obj2);
 	if (err)
 		goto done;
-	fprintf(outfile, "commit: %s\n", id_str);
+	if (fprintf(outfile, "commit: %s\n", id_str) < 0) {
+		err = got_error_from_errno();
+		free(id_str);
+		goto done;
+	}
 	free(id_str);
-	fprintf(outfile, "author: %s\n", commit2->author);
-	if (strcmp(commit2->author, commit2->committer) != 0)
-		fprintf(outfile, "committer: %s\n", commit2->committer);
-	fprintf(outfile, "\n%s\n", commit2->logmsg);
+	if (fprintf(outfile, "author: %s\n", commit2->author) < 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
+	if (strcmp(commit2->author, commit2->committer) != 0 &&
+	    fprintf(outfile, "committer: %s\n", commit2->committer) < 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
+	if (fprintf(outfile, "\n%s\n", commit2->logmsg) < 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
 
 	err = got_diff_objects_as_trees(tree_obj1, tree_obj2, repo, outfile);
 done: