dir.c better support for permissions