buf_size = in_len - offset;
if (buf_size > MMAP_BLOCKSIZE) buf_size = MMAP_BLOCKSIZE;
- if ((in_buf = mmap(0, buf_size, PROT_READ, MAP_SHARED, in_fd, offset))==0 ||
- (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==0) {
+ if ((in_buf = mmap(0, buf_size, PROT_READ, MAP_SHARED, in_fd, offset))==MAP_FAILED ||
+ (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==MAP_FAILED) {
perror("mmap()");
goto out;
}
TESTSUITE_COPY_CODE;
copyMem(out_buf, in_buf, buf_size);
- munmap(const_cast(void *)(in_buf), buf_size); in_buf = 0;
munmap(out_buf, buf_size); out_buf = 0;
+ munmap(const_cast(void *)(in_buf), buf_size); in_buf = 0;
}
res = true;
}
out:
- if (in_buf !=0) munmap(const_cast(void *)(in_buf), buf_size);
if (out_buf!=0) munmap(out_buf, buf_size);
+ if (in_buf !=0) munmap(const_cast(void *)(in_buf), buf_size);
return res;
}