> /* map the file and load an extra page in case the new line expands the > file across the page boundary; adding 2 allows for the truncating > effect of integer division. Forcing an extra page ensures > that we can identify the end of the buffer by finding a NUL */
No, it does not. Access past the EOF will give you page fault, not zero-filled page. > if ((int)(buf = (char *) mmap(buf, ((c / getpagesize()) + 2) * > getpagesize(), > PROT_NONE, MAP_SHARED, fileno(ucf), 0)) == -1) { > perror("Could not map user_clusters"); > exit(LOC_ERR_READ_FAIL); > }