specify permissions and O_CREAT for pidfile, use strlen vs sizeof