add protection mode check on file descriptors