Add compat/fopen.c which returns NULL on attempt to open directory