execpermfix.c: cleaned much of the code, and fixed bugs.

Using read instead of mmap makes it safer to use in 64bit environments.