Commit e4b9a50c4562bd5527f8a0a3c8c754c2c95031ca

Stefan Sperling 2019-07-27T23:47:46

read_meta_file() can fstat() instead of lstat() since file is already open

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/lib/worktree.c b/lib/worktree.c
index cbb8b46..d13a217 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -142,8 +142,8 @@ read_meta_file(char **content, const char *path_got, const char *name)
 		goto done;
 	}
 
-	if (lstat(path, &sb) != 0) {
-		err = got_error_from_errno2("lstat", path);
+	if (fstat(fd, &sb) != 0) {
+		err = got_error_from_errno2("fstat", path);
 		goto done;
 	}
 	*content = calloc(1, sb.st_size);