summaryrefslogtreecommitdiff
path: root/CCache/unify.c
diff options
context:
space:
mode:
authorNishant Gupta <nish.gupta01@gmail.com>2016-07-30 12:47:53 +0530
committerNishant Gupta <nish.gupta01@gmail.com>2016-07-30 12:47:53 +0530
commit6e8ba0be53a84373f04e05b18e96a13d8bfeb2de (patch)
treec5549e8e3bb3cd927ec3e6840b774830a41b29e4 /CCache/unify.c
parenta1e52520a12e1b53edaa2d79e4f9930172aaada5 (diff)
parentd0a45be1ebfe125d51696b48cb5d359bc7431052 (diff)
downloadswig-6e8ba0be53a84373f04e05b18e96a13d8bfeb2de.tar.gz
Merge remote-tracking branch 'upstream/master'
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);