diff options
author | soumith <soumith@fb.com> | 2016-10-26 17:23:04 +0300 |
---|---|---|
committer | soumith <soumith@fb.com> | 2016-10-26 17:23:04 +0300 |
commit | b9a918fac7866b8cb42a94a8608e460346de69ba (patch) | |
tree | a82768f9d9972edcae34ef95db3b7cf73a43986b | |
parent | 1037772e952e910ece55820683852cf369022a96 (diff) |
fix bug in mmapingfixmmap
-rw-r--r-- | lib/TH/THAllocator.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/TH/THAllocator.c b/lib/TH/THAllocator.c index 5b06502..4f4f04f 100644 --- a/lib/TH/THAllocator.c +++ b/lib/TH/THAllocator.c @@ -250,12 +250,8 @@ static void *_map_alloc(void* ctx_, ptrdiff_t size) { if(ctx->flags) { - /* if it is shared mem, let's put it in correct size */ - if (ctx->flags & TH_ALLOCATOR_MAPPED_SHAREDMEM) - { - if(ftruncate(fd, size) == -1) - THError("unable to resize shared memory file <%s> to the right size", ctx->filename); - } + if(ftruncate(fd, size) == -1) + THError("unable to resize file <%s> to the right size", ctx->filename); if(fstat(fd, &file_stat) == -1 || file_stat.st_size < size) { close(fd); |