summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2013-03-25 18:16:02 -0700
committerEdward Thomson <ethomson@microsoft.com>2013-03-25 18:16:02 -0700
commitd828f118b334a9396ca129f2c733bae8ce6faa8d (patch)
tree04eb96116fc0876651a704501e4d1b3f90c5063a /src/checkout.c
parentf17951d6ea4ba18c68716a89d7b7464e40ec98f7 (diff)
downloadlibgit2-d828f118b334a9396ca129f2c733bae8ce6faa8d.tar.gz
don't stat until the file is written
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 5a2698e41..2a29b1862 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -666,11 +666,11 @@ static int buffer_to_file(
giterr_set(GITERR_OS, "Could not write to '%s'", path);
(void)p_close(fd);
} else {
- if ((error = p_fstat(fd, st)) < 0)
- giterr_set(GITERR_OS, "Error while statting '%s'", path);
-
if ((error = p_close(fd)) < 0)
giterr_set(GITERR_OS, "Error while closing '%s'", path);
+
+ if ((error = p_stat(path, st)) < 0)
+ giterr_set(GITERR_OS, "Error while statting '%s'", path);
}
if (!error &&