aboutsummaryrefslogtreecommitdiff
path: root/qidx.c
diff options
context:
space:
mode:
Diffstat (limited to 'qidx.c')
-rw-r--r--qidx.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/qidx.c b/qidx.c
index acad8e9..16da3a7 100644
--- a/qidx.c
+++ b/qidx.c
@@ -612,11 +612,6 @@ qidx_err_t qidx_create(qidx_fp_t ** _fp, int fd, uint32_t _n_buckets, uint32_t m
off += max_bucket_size;
}
- // REVISIT
- for(size_t i = n_buckets - 1; i > 0; i--) {
- fp->htab->rb_start[fp->htab->buckets[i].offset] = '\1';
- }
-
return QIDX_OK;
}
@@ -629,12 +624,16 @@ qidx_err_t qidx_close(qidx_fp_t * fp) {
fp->buckets[i].n_bytes = htole32(htab->buckets[i].n_bytes);
fp->buckets[i].offset = htole64(htab->buckets[i].offset);
}
+
+ if(msync(fp->map, fp->len, MS_SYNC) == -1) {
+ return QIDX_MAP_FAIL;
+ }
}
free(htab->buckets);
free(htab);
- if(munmap(fp->map, fp->len) != -1) {
+ if(munmap(fp->map, fp->len) == -1) {
return QIDX_MAP_FAIL;
}