This test checks if we get the appropriate error message when writing to an unwritable file. However, it fails on bots which run check-all using sudo (in general this is something we'd like to support). Fix up the test so it works even if run as sudo.
Note: I'm not sure if this patch breaks Windows compatibility. If someone can tell, please comment :).