summaryrefslogtreecommitdiff
path: root/CCache/unify.c
diff options
context:
space:
mode:
Diffstat (limited to 'CCache/unify.c')
-rw-r--r--CCache/unify.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/CCache/unify.c b/CCache/unify.c
index a93d48a02..7a36476a1 100644
--- a/CCache/unify.c
+++ b/CCache/unify.c
@@ -281,6 +281,7 @@ int unify_hash(const char *fname)
fd = open(fname, O_RDONLY|O_BINARY);
if (fd == -1 || fstat(fd, &st) != 0) {
cc_log("Failed to open preprocessor output %s\n", fname);
+ if (fd != -1) close(fd);
stats_update(STATS_PREPROCESSOR);
return -1;
}
@@ -289,12 +290,12 @@ int unify_hash(const char *fname)
lines in preprocessor output. I have seen lines of over
100k in length, so this is well worth it */
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ close(fd);
if (map == (char *)-1) {
cc_log("Failed to mmap %s\n", fname);
stats_update(STATS_PREPROCESSOR);
return -1;
}
- close(fd);
/* pass it through the unifier */
unify((unsigned char *)map, st.st_size);