Merge pull request #667 from nulltoken/fix/p_open compat: make p_open able to accept optional mode when passing the O_CREAT flag