Skip to content

Commit

Permalink
re: issue #401
Browse files Browse the repository at this point in the history
It turns out that the chunksize used in the
ncio-related code must be a multiple of eight in
size.  Both memio.c and mmapio.c were
potentially violating this constraint.

See also pr #400
  • Loading branch information
DennisHeimbigner committed May 3, 2017
1 parent 8dddd22 commit 6dc6cf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libsrc/memio.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ fprintf(stderr,"memio_open: initial memory: %lu/%lu\n",(unsigned long)memio->mem
/* Use half the filesize as the blocksize ; why? */
sizehint = filesize/2;

/* sizehint must be multiple of 8 */
sizehint = (sizehint / 8) * 8;
if(sizehint < 8) sizehint = 8;

fd = nc__pseudofd();
*((int* )&nciop->fd) = fd;

Expand Down
4 changes: 4 additions & 0 deletions libsrc/mmapio.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ fprintf(stderr,"mmapio_open: initial memory: %lu/%lu\n",(unsigned long)mmapio->m
/* Use half the filesize as the blocksize */
sizehint = filesize/2;

/* sizehint must be multiple of 8 */
sizehint = (sizehint / 8) * 8;
if(sizehint < 8) sizehint = 8;

fd = nc__pseudofd();
*((int* )&nciop->fd) = fd;

Expand Down

0 comments on commit 6dc6cf6

Please sign in to comment.