summaryrefslogtreecommitdiff
path: root/manifest.c
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2010-12-13 20:46:06 +0100
committerJoel Rosdahl <joel@rosdahl.net>2010-12-13 20:46:30 +0100
commit4af73e1ee918aa6899281d27dfe6c3ec4e580dca (patch)
tree38b4de036af555753917fcad313d2ebc663a0105 /manifest.c
parentc2495a2d7cd6637a99ad53bb71b4bf7996f3cd61 (diff)
downloadccache-4af73e1ee918aa6899281d27dfe6c3ec4e580dca.tar.gz
Avoid creating empty file before creating new manifest file
Diffstat (limited to 'manifest.c')
-rw-r--r--manifest.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/manifest.c b/manifest.c
index bcedde2e..f9c4dd0f 100644
--- a/manifest.c
+++ b/manifest.c
@@ -581,7 +581,6 @@ manifest_put(const char *manifest_path, struct file_hash *object_hash,
int ret = 0;
int fd1;
int fd2;
- struct stat st;
gzFile f1 = NULL;
gzFile f2 = NULL;
struct manifest *mf = NULL;
@@ -593,17 +592,8 @@ manifest_put(const char *manifest_path, struct file_hash *object_hash,
* not a big deal, and it's also very unlikely.
*/
- fd1 = safe_open(manifest_path);
+ fd1 = open(manifest_path, O_RDONLY | O_BINARY);
if (fd1 == -1) {
- cc_log("Failed to open manifest file");
- goto out;
- }
- if (fstat(fd1, &st) != 0) {
- cc_log("Failed to stat manifest file");
- close(fd1);
- goto out;
- }
- if (st.st_size == 0) {
/* New file. */
mf = create_empty_manifest();
} else {