[darcs-users] darcs patch: Handle empty files in mmapFilePS. Also cater for FD sh...
me at mornfall.net
Thu Feb 5 08:24:51 UTC 2009
Judah Jacobson <judah.jacobson at gmail.com> writes:
> I think the below code might be slightly cleaner:
> x <- unsafeMMapFile `catch` $ \e -> do
> size <- fileSize `fmap` getSymbolicLinkStatus f
> if size == 0
> then return B.empty
> else throwIO e
> That is, explicitly re-throw the caught exception, rather than calling
> unsafeMMapFile again to get it implicitly re-thrown.
The idea is that after performGC, there is a reasonable chance that the second
call will actually succeed.
> Though, for this specific situation it probably doesn't make a big
> difference which way you do it.
It makes a difference, since this way it won't recover on out-of-fd's failure,
unlike the proposed one -- this version will fail for good, which will
basically kill darcs, there's no recovery elsewhere as far as I can tell.
Peter Rockai | me()mornfall!net | prockai()redhat!com
http://blog.mornfall.net | http://web.mornfall.net
"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
-- Blair P. Houghton on the subject of C program indentation
More information about the darcs-users