if (chunk > nrbytes)
chunk = nrbytes;
- if (call == FSC_READ) {
+ if (call != FSC_WRITE) {
bytes_left = f_size - position;
if (position >= f_size) break; /* we are beyond EOF */
if (chunk > (unsigned int) bytes_left) chunk = bytes_left;
if(map_handle_memory(vmp, newregion, 0, length, 1,
NULL, 0, 0) != OK) {
printf("VM: map_page_region: prealloc failed\n");
- free(newregion->physblocks);
- USE(newregion,
- newregion->physblocks = NULL;);
- SLABFREE(newregion);
+ map_free(newregion);
return NULL;
}
}
return r;
}
- region_start_iter(&vmp->vm_regions_avl, &v_iter, nextvr->vaddr, AVL_EQUAL);
- assert(region_get_iter(&v_iter) == nextvr);
+ if(nextvr) {
+ region_start_iter(&vmp->vm_regions_avl, &v_iter, nextvr->vaddr, AVL_EQUAL);
+ assert(region_get_iter(&v_iter) == nextvr);
+ }
}
return OK;