Looks good, but..
I would really suggest just defaulting to
mode = 0444 & ~mode;
since there simply is never any reason to allow a writable pack-file.
The fact that we have some tests that try to corrupt a pack-file is not
really a reason. Just make them do "chmod +w" before corrupting it.
But your patch is an obvious improvement regardless, so I certainly don't
think this is a *big* issue.
Linus
-