|
From: Doug R. <df...@nl...> - 2004-01-09 17:47:03
|
On Fri, 2004-01-09 at 17:40, Nicholas Nethercote wrote: > On Fri, 9 Jan 2004, Doug Rabson wrote: > > > > Diff is attached, feedback welcome. I hope the way I mmap'd in the .rc > > > files and didn't munmap them is reasonable. > > > > This will have problems if the file is exactly getpagesize() bytes long > > since the mmap'ed image won't be null terminated. > > Would changing this: > > f_clo = mmap(0, s1.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); > > to this > > f_clo = mmap(0, s1.st_size+1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); > > fix it? Probably. It does seem easier to malloc+read the contents though. |