On Fri, Nov 11, 2011 at 03:04:28PM +0800, Michael W. Bombardieri wrote: > Sorry, let me try that again... Forgot to clean up file descriptor ifd.
AFAIK, this works without this diff. What problem are you trying to solve? -Otto > > > Index: inp.c > =================================================================== > RCS file: /usr/src/cvs/src/usr.bin/patch/inp.c,v > retrieving revision 1.35 > diff -u -r1.35 inp.c > --- inp.c 27 Oct 2009 23:59:41 -0000 1.35 > +++ inp.c 11 Nov 2011 06:51:13 -0000 > @@ -243,6 +243,10 @@ > if ((ifd = open(filename, O_RDONLY)) < 0) > pfatal("can't open file %s", filename); > > + if (i_size == 0) { > + close(ifd); > + return true; > + } > i_womp = mmap(NULL, i_size, PROT_READ, MAP_PRIVATE, ifd, 0); > if (i_womp == MAP_FAILED) { > perror("mmap failed");