Commit ae4cae4e08bd3a8a52069f00a688072ef1e85542

Russell Belfer 2012-03-22T13:37:47

Merge pull request #607 from nulltoken/fix/file-close-on-error test helpers: Fix file close on error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 9ed0d79..fc03519 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -197,7 +197,8 @@ int copy_file(const char *src, const char *dst)
 
 cleanup:
 	git_buf_free(&source_buf);
-	p_close(dst_fd);
+	if (dst_fd >= 0)
+		p_close(dst_fd);
 
 	return error;
 }