[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc6 bug? or C programming error?



On Wed, 2003-12-03 at 00:52, viro@parcelfarce.linux.theplanet.co.uk
wrote:
> >   /* 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.

Do you think that is connected with this problem?  There is no error
when the mmap() call was executed; the segfault occurs a little later,
as the trace shows.

Does that mean you cannot use mmap() and related calls to extend the
length of a file?

> >   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);
> >   }
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "What shall we then say to these things? If God be for 
      us, who can be against us?"              Romans 8:31 



Reply to: