diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-10-26 17:27:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-26 17:27:32 +0300 |
commit | fecf29bb6ad7b8117eff9712d833972205de1201 (patch) | |
tree | a82768f9d9972edcae34ef95db3b7cf73a43986b | |
parent | 1037772e952e910ece55820683852cf369022a96 (diff) | |
parent | b9a918fac7866b8cb42a94a8608e460346de69ba (diff) |
Merge pull request #817 from torch/fixmmap
fix bug in mmaping
-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); |