Commit 07a7f8ade254a4d5ce8af30faf37748391c19da0

Stefan Sperling 2018-03-11T11:59:31

in work tree test code, use stat() to test existence of file

diff --git a/regress/worktree/worktree_test.c b/regress/worktree/worktree_test.c
index 030daff..7e70195 100644
--- a/regress/worktree/worktree_test.c
+++ b/regress/worktree/worktree_test.c
@@ -102,17 +102,14 @@ remove_worktree(const char *worktree_path)
 static int
 check_meta_file_exists(const char *worktree_path, const char *name)
 {
-	FILE *f;
+	struct stat sb;
 	char *path;
 
 	if (asprintf(&path, "%s/%s/%s", worktree_path, GOT_WORKTREE_GOT_DIR,
 	    name) == -1)
 		return 0;
-	f = fopen(path, "r");
-	free(path);
-	if (f == NULL)
+	if (stat(path, &sb) == -1)
 		return 0;
-	fclose(f);
 	return 1;
 }